OpenGL - how to render an object for a 3D texture as a three-dimensional billboard

I am trying to implement volumetric billboards in OpenGL 3.3+, as described here and the video here . The problem I'm currently facing (quite simple): how to render a 3D object for a 3D texture (as described in the article) effectively ? Assuming the object can be saved in 256x256x128 tex, creating framebuffers of 256*256*128*2 (because it said that it should be displayed twice on each axis: +X,-X,+Y,-Y,+Z,-Z ) will be insane, and there are too many texture units to process many textures as far as I know (not to mention the amount of time needed).

Does anyone know how to handle something like this?

+6
source share
1 answer

A 3D texture slice can be directly attached to the current framebuffer. So, create a frame buffer, a three-dimensional texture, and then render, for example:

 glFramebufferTexture3D( GL_FRAMEBUFFER, Attachment, GL_TEXTURE_3D, TextureID, 0, ZSlice ); ...render to the slice of 3D texture... 

So, you need only 1 framebuffer, which will be repeated by the number of Z-fragments in your target 3D texture.

+4
source

Source: https://habr.com/ru/post/948849/


All Articles