alpha face sorting inside single mesh? 2004-03-29 - By NoiseCrime
Back
-- -- Original Message -- -- From: "Mads Rydahl" <mads@(protected)>
> Is this true for shader assignment as well? I had some problems swapping the > individual shaders of each face, and it seemed like the only way to get them > updated was to run another build().
If you're building a mesh that has multiple shaders, then thats going to give you problems.
First off it terms of performance its possibly the worse thing to do, because sw3d has to take that mesh and break it down into groups of polygons that share the same shader. This also results in vertices getting duplicate at boundaries between polygons that have two or more shaders sharing an edge, meaning sw3d must remap any changes you make to the vertex list to match the new submeshes.
The basic way 3d works today is to render batches of polygons using the same state set up (including textures, lighting, etc). So SW3D converts all meshes into this format. That is it breaks down models with multiple meshes into a single model with multiple meshes, where each sub mesh is composed of traingles that use a single shader.
So you'll proberbly find it much easier not to mention faster to update the mesh if you build a mesh per shader/texture.
> You're absolutely right. Currently, the textures are stored in the resolution > suitable for the online 2d sprite version, and are scaled to an odd size only > for these test purposes. But what are the problems/disadvantages of using non > power of two sizes? Will they get interpolated when sent to the gfx card?
Well you'll lose visual quailty as they will be shrunk to the nearest power of 2 , although that does not mean square textures, you can have say 128x64 or 512x64 etc. In terms of perfroamnce you'll take a small hit when sw3d first scales the image to a power of 2 dimension, and if you change any texture property, but other than that there shouldn't be much of a problem.
Actually a far better improvement (if the 2d sprites are small) is to combine many sprites ona single texture. This will reduce the number of shaders and therefore submeshes needed, not to mention minimise 3D state changes which can be costly. So go with a 256x256 or even 512x512 collage of your 2d sprites, then adjust the UV values to map sprites to quads.
> Everything is currently displayed as a single mesh within a single model. I am > just swapping the shaders (and offsetting the vertex coords) on the faces that > show the explosions. They are not the same faces as the objects that explode, > though. I need to display the explosion in front of the objects, so I have set > aside the last 100 faces of the model to display overlays when needed.
As i said previously, definately split out different aspects of the game into different models. The exlposions would be prime canidate for doing that. As sorting is model based, this should assist in maintaining the correct draw order.
> They do appear to draw in shader order, but how does sw3d determine which > shader's faces to draw first? And is there a way to force shader order, or will > I have to use the same shader for all faces and swap texturecoods to be in full > control?
Thats not really known - see my previous z-buffer post.
Noisecrime 2004
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ Dir3d-l mailing list Dir3d-l@(protected) http://nuttybar.drama.uga.edu/mailman/listinfo/dir3d-l
|
|