jPCT-AE - a 3d engine for Android > Support

How to improve the performance of SkyBox?

<< < (2/3) > >>

Raswr:
I'm not a fan of rendering the sky as a first object, I prefer leaving it to the last object. That it because if you draw the sky first without z test, you draw ALL the fragments of the sky, and probably many of them are going to be overwritten by other geometry, making some fragment rendering useless (and expensive if your sky uses some kind of shader).

I usually draw the sky the last with a vertex shader that does this to push the sky back into the far clipping plane, so it seems as it was in the infinity:


--- Code: ---vec4 p=modelViewProjectionMatrix * position; //vert to eye space
gl_Position = vec4(p.x, p.y, p.w, p.w);           // replace z by w, this pushes skydome vertex back to the far plane
--- End code ---

This way, the sky is pushed back in the far plane (no size issues) and you are rendering it in the last position with z test enabled, so probably many of the sky's fragments are ocluded by other things in your scene and it will be cheaper to render.

Hope I helped.

EgonOlsen:
Rendering order shouldn't matter on any mobile device except Tegra, because they are all deferred renderers anyway (....except for Tegra).

Raswr:

--- Quote from: EgonOlsen on March 30, 2013, 08:57:21 pm ---Rendering order shouldn't matter on any mobile device except Tegra, because they are all deferred renderers anyway (....except for Tegra).

--- End quote ---

Interesting I didn't know that, I come from programming desktop OpenGL so that's a good thing to know. Then, sending  the sky to render as the last object with depth test enabled wouldn't give any benefit on a phone (except the Tegra devices)?

I'll try some experiments anyway if I get time :) (both my devices are adrenos)

Thank you for the info.

kiffa:
Thanks, Raswr. I will try your method.

In my test, rendering the sky in 2 worlds will cause a fps-down of 5-7(from 54+ to 47+), and the ADT says rendering the sky-world consumed about 9% cpu-time .

If i scale the sky to a large one which can envelop the whole scene, then render the sky in the main world as a normal object  as others, the fps has almost little down.

Maybe there is something wrong in my codes...

Another question, if i want to do the profiling, i can use ADT to do the cpu-profiling, but how to profile the gpu? Between cpu and gpu,  who will kill more performance?

EgonOlsen:
I don't see how putting the sky in an additional world can cause a significant hit. Which device are you using for testing?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version