Render to texture tutorial - Skin Investigation

Render to texture tutorial

Tutorial 14 : Render To Texture

Render-To-Texture is a handful method to create a variety of effects. The basic idea is that you render a scene just like you usually do, but this time in a texture that you can reuse later.

Applications include in-game cameras, post-processing, and as many GFX as you can imagine.

We have three tasks : creating the texture in which we’re going to render ; actually rendering something in it ; and using the generated texture.

Creating the Render Target

What we’re going to render to is called a Framebuffer. It’s a container for textures and an optional depth buffer. It’s created just like any other object in OpenGL :

// The framebuffer, which regroups 0, 1, or more textures, and 0 or 1 depth buffer. GLuint FramebufferName = 0; glGenFramebuffers(1, &FramebufferName); glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);

Now we need to create the texture which will contain the RGB output of our shader. This code is very classic :

// The texture we're going to render to GLuint renderedTexture; glGenTextures(1, &renderedTexture); // "Bind" the newly created texture : all future texture functions will modify this texture glBindTexture(GL_TEXTURE_2D, renderedTexture); // Give an empty image to OpenGL ( the last "0" ) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 768, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); // Poor filtering. Needed ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

We also need a depth buffer. This is optional, depending on what you actually need to draw in your texture; but since we’re going to render Suzanne, we need depth-testing.

// The depth buffer GLuint depthrenderbuffer; glGenRenderbuffers(1, &depthrenderbuffer); glBindRenderbuffer(GL_RENDERBUFFER, depthrenderbuffer); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, 1024, 768); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthrenderbuffer);

Finally, we configure our framebuffer

// Set "renderedTexture" as our colour attachement #0 glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, renderedTexture, 0); // Set the list of draw buffers. GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT0}; glDrawBuffers(1, DrawBuffers); // "1" is the size of DrawBuffers

Something may have gone wrong during the process, depending on the capabilities of the GPU. This is how you check it :

// Always check that our framebuffer is ok if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) return false;

More about Render to texture tutorial

Transparent gif

by cdub

In photoshop, keep selecting all the background until you have all of you want to be transparent...Try deleting background and see if the underlying backgroundis already transparent. (If your final image is easy to select, select it directly.). If initially selecting the BACKGROUND, and you need to get a transparent bckgrnd, inverse the selection so the main subject is selected. You may already have a Transparent background (you'll see the checkerboard).
If you don't already have an underlying transparent background, Copy the selected imaged.
Open new file, with Transparent background

3ds Max baking Ambient Occlusion tutorial for beginners HD
3ds Max baking Ambient Occlusion tutorial for beginners HD
3ds max garbage can trash tutorial model texture lighting
3ds max garbage can trash tutorial model texture lighting ...

CorelDRAW X7 review: Customizable features make this robust design program ..  — PCWorld
.. purchase, as well as a $25 monthly subscription. People miffed by Adobe's wholesale move to subscriptions will find a great alternative here. ..

Galaxy 61 Delivers Show Open for VH1's 'The Fabulous Life  — Animation World Network
VHI recently called upon Galaxy 61 to create a show intro for the new 2014 season of The Fabulous Life, the hit series that reveals the extravagant places, possessions and pastimes of pop-culture's most famous celebrities. The Brooklyn-based ..

Eovia EOVIA Carrara Studio 2 (Windows)
Software (Eovia)
  • This powerful 3D graphics application has a huge variety of tools for better modeling, animation, rendering, and special effects
  • Each step of the creative process is divided into simple steps, for the beginning & intermediate user s benefit
  • Try out five rendering engines, seven different modelers and multiple animation tools
  • Interactive tutorials walk users through the advanced shading editors and sky environment tools
  • Over a thousand high-quality 3D models and textures are here for you to draw from
Related Posts