searching for speed graphics advice

Blitz3D Forums/Blitz3D Beginners Area/searching for speed graphics advice

Santiworld(Posted 2009) [#1]
hi, i have some problems, when my racecar game have to many objects to draw in each frame...

cars, track, trees, other objects...

some objects, like trees, have 2 texture, one for color other for transparence... (i know, the transparences make more slower the render).

there is any way to make renders more faster?...
some render libs for blitz? anything...
can i use openGL with blitz?, is difficult to use?

i post a screenshot, i want 60 fps for my game...
i have 63, for now, but if i have many objects, or more than 6 cars, the fps reach 30 40 fps.

regards
santiago (latatoy)


Ross C(Posted 2009) [#2]
Have you tried using copyentity, instead of loading each entity individually. Same with trees.

Are you using compressed textures? (.dds format) They will reduce your VRAM requirements, and prevent swapping, if any is occuring.

Have your tried,

Flip Flase

To eliminate any v-sync.


Santiworld(Posted 2009) [#3]
hi Ross C, thanks..

i go to check info about dds texture.
i don't know anything about that :p
maibe with dds i improve the render speed.

i have flip false, and frametimer (60)

where can i read more about vram for textures?

anything about openGL?


Ross C(Posted 2009) [#4]
I don't know about openGL, as blitz only uses DX.

On average though, i'd say .dds textures can 1/4 your VRAM requirements.


Andy(Posted 2009) [#5]
>i have flip false, and frametimer (60)

Are you saying that you use WaitTimer(60) ?

Try this instead
http://www.blitzbasic.com/codearcs/codearcs.php?code=2434


DheDarkhCustard(Posted 2009) [#6]
Try using smaller textures? like 32 x 32 or even 16x16, if you are going fast you won't need large textures (blurry) or even reduce the textures of far away objects.

I have a question to ask you actually... how do you use opacity textures?


John Blackledge(Posted 2009) [#7]
Because of this thread I tried converting all of my textures to dds, and found a definite speed increase overall, less juddering as the camera pans, even though in some cases the images were 10x the original filesize.


Ross C(Posted 2009) [#8]
It should be. Usually, graphics cards have to swap their contents, to fit the new textures being rendered, into VRAM if they isn't enough room. This swapping usually takes time.


GfK(Posted 2009) [#9]
Try using smaller textures? like 32 x 32 or even 16x16
Yes, that'd work, if you don't mind your game looking like a turd-smeared bus window.


Santiworld(Posted 2009) [#10]
hi :).

Andy, yes, i'm using Waittimer(60), i going to check the link you post.

is a good idea reduce some textures when the car is going faster, but, i going to use a car texture, from 128x128 (low detail texture) to (2048x2048) for the player car in ultra detail..

i using to make the game this video cards..
nvidia 260 (full detail)
nvidia 6800 (normal)
nvidia 6100 (ultra low) in a laptop

the minimun resolution i am going to use is 640x400 or 640/480
recommended 1024/768/32/1

DheDarkhCustard --> I have a question to ask you actually... how do you use opacity textures?


in some case, like car glass, i use entityalpha, the glass have a texture.
in the trees, i use 2 textures :

t blend alpha texture
1 alpha alpha the tree transparence (black and white) 512x512
2 multiply color color tree texture 512x512

the cars have one ENVMAP texture, with blend(add) 512x512 for reflects

this week i going to learn about VRAM,DDS textures, and use some LODS for textures depending the spped and distance...
i have LODS for the car mesh, and i trying to do the same with all objects, more distances, less detail..


BIG BUG(Posted 2009) [#11]
One thing you should keep in mind is the amount of drawn surfaces.
Especially static and similar objects like trees should be combined to clusters, each one a single mesh -> AddMesh command.
Same for your tribunes, I hope you've used only one surface per tribune?
You should try to reduce the surface count per car also. Maybe you can abandon transparent windows for the sake of rendering speed? This will save polygons also, as there is no need for interior anymore.

Use a Single Surface sprite library rather than native Blitz3D sprites.

Replace WaitTimer as Andy suggested.


There is no need to use LOD on textures as this is done by your graphic card automatically, which is called MipMapping.
Also, from what I can tell by your screenshots, your texture resolution seems appropriate.


Zethrax(Posted 2009) [#12]
Trying to minimize the number of mesh surfaces in a scene is a good idea, but don't go too far overboard in combining everything together. If you combine everything into a single mesh, frustum culling won't work effectively in culling out entities that are outside the view frustum.

Basically, you've got to find the right balance, depending on how your scene is organized.


John Blackledge(Posted 2009) [#13]
I can confirm what Bill said.
I had a whole village of buildings, then used AddMesh to combine everything and the prog nearly staggered to a halt.


Ross C(Posted 2009) [#14]
I believe DX has a triangle limit of some sorts, where it throws batches of polygons at the graphics card. Having more than 2000 (i think that was the limit), results in the graphics card having to process two sets of triangles. Basically, rendering a mesh/surface of anywhere between 100 and 2000 triangles, doesn't take much different time.

I will post the test i used to confirm this information. Basically, keep your surfaces below 2000 triangles if you can, for optimal rendering.


Santiworld(Posted 2009) [#15]
that is a very important info..

all tips to reduce the render time, increasethe fps..

maybe we can make something like a list of tips to take the best of the blitz and dx7, to make games and programas with complex graphics details.

tips like copymesh, vram, dds textures, addmesh with the limit of 2000 triangles..

if i use hidemesh, does the video card calculate that mesh?


John Blackledge(Posted 2009) [#16]
No, HideMesh removes the mesh from the calculations.
But don't forget that Blitz already culls meshes that are outside the camera view.


Zethrax(Posted 2009) [#17]
There's no command called HideMesh. I imagine you're both thinking of HideEntity.

Something to bear in mind is that HideEntity also turns off collisions and picking, so it may not be the best command to use if you need your off screen elements to still be collidable and pickable.

Another option for visibility management is to use the EntityAlpha command to set the alpha of an entity to zero. This will turn off all rendering for an entity, while still allowing it to be collidable and pickable. The downside of this is that if your entity is set to an intermediate alpha value, you'll need to restore it to that value when you wish to show it again. If the entity has an effect running that causes it's entity alpha value to fluctuate (particle systems, etc) you'll need to turn off that effect and turn it back on again when you re-show the entity.


nawi(Posted 2009) [#18]
Make 2 models of your car, one high poly and one low poly, and switch to the low poly one if the car is far enough.


Ross C(Posted 2009) [#19]
And use low poly invisible (entityalpha=0) for collisions and physics models, to reduce processing times. Simple cubes usually suffice.


Santiworld(Posted 2009) [#20]
yes...

i have a 3d car, with low and high detail..
i use ode, so the cars can be completly hide.. no problems with entitypick and collision (because ode)

question, entityalpha (x,0) or hideentity (x) are the same? for the proccesor and video car?, because sometime, i use a glass with alpha 0 and shining, i see the shining of the surface.. o i wrong?



example, i load the mesh with ...

car = loadanimmesh(car.b3d)

carlow = findchild ( car,"low")
carhigh = findchild ( car,"high")

if entitydistance (cam,car) > distancedetail then
showentity carlow
hideentity carhigh
else
hideentity carlow
showentity carhigh
end if


Ross C(Posted 2009) [#21]
That shouldn't happen, unless your using an outside lib with blitz. EntityAlpha still involves entities in collisions, therefore will take up processor time if that is the case. HideEntity hides an entity from collisions too, so it shouldn't take any time up.