PDA

View Full Version : shapes and opengl



giuseppe500
12-04-2016, 04:57 AM
Hello.
I have a casistic where i have 500000 objects of different shapes to extrude and draw.
The shapes have at max 16 point.
A first idea is to use instancing and select the shapes that are equals or similar and launch 3/4 batch of instancing for the similar i use a scale matrix.because a lot of objects are equal as shape but bigger or smaller.
the second idea is to use an istancing with geometry shader.
the third idea is to use deferred shading.
I'm not worried too much of the result of shading it isn't a game is an architectural program; but i can't find a decent solution for old gpus of 3/4 years ago.

GClements
12-04-2016, 11:11 AM
Unless the number of distinct shapes is particularly large, I'd be inclined to perform the extrusion on the CPU, then use either instancing or fake instancing (adding an integer attribute containing an object ID to index into the transforms). Fake instancing may be preferable if the number of shapes is large, as it allows drawing multiple shapes with a single draw call.

I can't see how deferred shading would help here. It's used mostly to reduce the complexity of lighting calculations, by eliminating lighting calculations for fragments which are occluded or outside of a light's region of influence.

Silence
12-05-2016, 12:53 AM
Do you plan to draw all of those 500000 objects each frame ?
If so, you should not. Have a look for space partition systems, as well as occlusion detection systems. This will improve a lot your rendering (and possibly calculations).

giuseppe500
12-14-2016, 06:54 AM
Unless the number of distinct shapes is particularly large, I'd be inclined to perform the extrusion on the CPU, then use either instancing or fake instancing (adding an integer attribute containing an object ID to index into the transforms). Fake instancing may be preferable if the number of shapes is large, as it allows drawing multiple shapes with a single draw call.

I can't see how deferred shading would help here. It's used mostly to reduce the complexity of lighting calculations, by eliminating lighting calculations for fragments which are occluded or outside of a light's region of influence.

Yes, there is a camera culling , and i write a max casistic in general i have 100000+- object and the camera not view all objects because a lot of object are culled, but now i have a question: memory :is better for you create all 3d object in the cpu with extruding at the start or do an instancing with a texture or more texture that have the shape , the direction and the depth and calculate the extrusion on the fly in the instancing?
i saw that more of these object have 4 point then the extrude object has 8 point and this is calculated at the start then with c++ i can delete all depth and direction information and shapes to save a lot of memory.
but for a batch i must generalize how i can use batch all those objects instead?
What is fake instancing and how i can get the correct shapes geometry in the vertex shader from a buffer or a texture?with the object id?
thanks.
thanks.