TrisRendered()

Blitz3D Forums/Blitz3D Programming/TrisRendered()

JBR(Posted 2004) [#1]
Hello, I'm using TrisRendered() to keep an eye on how many tris I'm using but initially I got 2 times what I should; drawing things twice I thought; but I wasn't and now I get less than what I should!

Is it reliable? or am I doing something wrong?
(All I was doing was drawing cones)

Thanks
Marg


jhocking(Posted 2004) [#2]
Can you be more specific than just "now I get less." For starters, what exactly did you change? And these cones, are they external meshes being loaded or are you creating them in code?


DJWoodgate(Posted 2004) [#3]
Trisrendered is a reliable tool. Blitz culls at the entity level based on the bounding volume. I believe the bounding volume ultimately tested against the view frustum is a bounding box. So you might well not have a cone on screen but it would still be passed for rendering because its bounding box is. This is exagerated by the perspectival projection.

This is an interesting one though because it led me to do some quick tests using orthographic projection mode that seem to indicate that the only culling that occurs in that mode is at near/far which is not something I had noticed before and seems just plain wrong. So Trisrendered is definately doing the trick as an aid to debugging!


Zethrax(Posted 2004) [#4]
As far as I know, TrisRendered doesn't factor in the culling of tris by the near and far camera ranges, though, so it's not 100% accurate in this regard.


JBR(Posted 2004) [#5]
I have a landscape as a mesh of which you cannot see all of it but it gives the correct tris count. Fine. I have now set up 16k cones (created in code each with 30 tris) which I'm using to test 'things' moving with the landscape. Instead of plotting 16k cones I HideEntity the ones not on screen (play area) and ShowEntity the ones which are.

If 25 are visible then I get 540 tris = 18 cones
If 20 are visible then I get 450 tris = 15 cones
if 16 are visible then I get 330 tris = 11 cones

(I think I was mistaken about getting twice as many earlier)

Marg


Boiled Sweets(Posted 2004) [#6]
Are you sure you have back face culling off? As I recall creating for example a cube it uses 24 tris not 12 as there are inside and outside faces...


Floyd(Posted 2004) [#7]
Blitz does some culling of things that are definitely off-screen.

Whatever remains is sent to the graphics card for rendering. But some of this may still be off-screen.

So TrisRendered() can be larger than the actual number of triangles drawn.

If there is a single mesh then it either gets culled or not.
As a result TrisRendered() will report nothing or everything.
Graphics3D 640, 480, 0, 1
WireFrame True

sph = CreateSphere(10)

cam = CreateCamera() : PositionEntity cam, 0, 0, -20: CameraZoom cam, 15

While Not KeyDown(1)
	RenderWorld 
	Text 10,20, "Total triangles: " + CountTriangles( GetSurface(sph,1) )
	Text 10,40, "  Tris Rendered: " + TrisRendered()
	Flip
	TurnEntity cam, 0, 0.01, 0
Wend
End