21.7 C
New York
Tuesday, April 29, 2025

OpenGL – How can I effectively render many transferring objects in a recreation?


I’m utilizing OpenGL, however this query should usually apply to illustration.

I perceive that for environment friendly illustration in video games, you wish to decrease communication between the CPU and the GPU. This implies preloading the best quantity of vertex knowledge as doable in graphic reminiscence earlier than a stage is began (throughout the stage load display). And replace the view and projection matrices to your digicam as soon as per image, then letting vertices shadows climb, flip and translate fashions as essential to signify the scene. You should use instanced illustration on this approach to decrease drawing calls.

This works very effectively for static geometry that by no means adjustments. However I don’t perceive how it is best to decrease communication between the CPU and the GPU when many objects transfer. Does this appear inconceivable?

If solely the CPU is aware of the brand new location of all of the objects that transfer round every portray, someway it should move that knowledge to the GPU. In the event you move the up to date mannequin matrices to maneuver objects to the GPU as uniforms for the vertex shader, is not this the CPU that speaks with the GPU? Is not this so gradual and what we’re purported to keep away from?

I perceive that we are able to use uniform buffer objects as an alternative of updating uniforms individually, however this nonetheless means sending many CPU knowledge to the GPU.

How can many objects signify effectively, whose mannequin matrices are altering every portray?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles