What is a surface?

BlitzMax Forums/BlitzMax Beginners Area/What is a surface?

H&K(Posted 2007) [#1]
Well basicly thats the question. I realise this is the Bmax thread, but what with all the 3d engines it a Bmax question.

So as simple as you can, please explain

1) What a surface is?
2) Whats the problem haveing loads of them


Dreamora(Posted 2007) [#2]
A surface is a surface.
This is the term DX uses for it :)

Problem with having lots of them: Each surface is transfered in its own to the GPU. This theoretically is no problem. But the problem is the switch between surfaces which takes time and for this reason, more surfaces = more time needed.
high end cards don't have a problem with that, but Intel and other low end cards can be brought to the point where they drop to 0 fps


Gabriel(Posted 2007) [#3]
When people use the phrase on these forums, they typically refer to something which was invented for Blitz3D. Blitz3D surfaces are a group of vertices and triangles which share the same material/visual properties. That is, the color, the texture(s) the shininess and anything else along those lines.

When you render your objects, you have to keep changing things are you render each object. You set a texture to render one object and then the next object might have a different texture, so have to set that texture instead. This is called a state change operation, and it's not particularly fast. Not as slow as it once was, but slow nonetheless. Blitz3d didn't let you choose how your objects were rendered. If you wrote your own renderer you'd sort by material properties and render such that the state changes were minimized. Keeping everything on one B3D surface meant that no state changes occured for that surface, and it was the nearest way anyone could find to speed up the renderer.

In theory, if B3D organized it's rendering properly, it wouldn't have mattered, but experiments with other methods ( copymesh or copyentity or something ) never quite yielded the same results.

Quite how that works in other engines will depend on the engine. But whatever engine you use, the more state changes, the slower it gets, so optimizing your render path such that the state changes are minimized ( and prioritizing them too, as some state changes are more expensive than others, and they all vary across all cards ( yes, it's really that hard to generalize ) ) is absolutely essiential to keep speed up.


Gabriel(Posted 2007) [#4]
A surface is a surface.
This is the term DX uses for it :)

No, that's wrong. DX does have something called surfaces, but they're not the same as Blitz3D surfaces. A D3D surface is just another name for an image or texture or collection of pixels. This is not what B3D surfaces are.


H&K(Posted 2007) [#5]
Ok, so working on the assumption that it better to have as many textures as possible on one Image. (Please if this is not so then tell me, but the above replies imply so).
Then what is the biggest/largest size that an image-texture map can be.
(If that a how big is a ball of string question, then what the biggest I should really make it)

Im assumeing that each card will be different, but that they will be generaly standard. SO 512.512 upwards to mayby 2048.2048 or could I go for 4096.4096 safly?
(As you can see I have no idea. - But I assume maxscreenWidth^2 would be safe)


Gabriel(Posted 2007) [#6]
Most cards will support 4096x4096, but that doesn't necessarily mean you should use that. Using very big textures has performance implications too. I would be very wary of going over 1024x1024 ( except for things like landscapes. )


H&K(Posted 2007) [#7]
Ahh, but the plan isnt for very big textures, its for lots of little textures on a big image. Would that still have the big texture performance implications?

(Oh and thanks, Ill start on the assumption that 1024^2 is ok)


Gabriel(Posted 2007) [#8]
Yes, it would have the same implications. You know it's lots of small textures, but DirectX just sees as it one big texture that you're only mapping small pieces of.

Starting with 1024^2 and then adjusting upward or downward depending on the performance you experience sounds like a good plan.


tonyg(Posted 2007) [#9]
Run this and it should give your graphics card capabilities for pow2, maxtextures etc.