About Store Forum Documentation Contact



Post Reply 
Transparent backgroud when rendering to texture
Author Message
mixpro Offline
Member

Post: #1
Transparent backgroud when rendering to texture
Hi,
in Render to Texture Tutorial , i tried removing the box leaving only the ball drawn in the texture .
doing so renders the ball surrounded by black color inside the texture , how do i make the texture transparent (removing the black color , leaving the ball only in the texture ) ?
(This post was last modified: 05-20-2016 07:31 AM by mixpro.)
05-20-2016 07:31 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: Transparent backgroud when rendering to texture
You might want to check this tutorial:
UID(240031802, 1298250585, 1065203598, 2912159632) /* Apps\12 - Rendering\13 - Combining Render with Background */

Although it does not give you a texture.
05-20-2016 01:13 PM
Find all posts by this user Quote this message in a reply
mixpro Offline
Member

Post: #3
RE: Transparent backgroud when rendering to texture
(05-20-2016 01:13 PM)Esenthel Wrote:  You might want to check this tutorial:
UID(240031802, 1298250585, 1065203598, 2912159632) /* Apps\12 - Rendering\13 - Combining Render with Background */

Although it does not give you a texture.

Hi Esenthel ,
i wasn't able to do so , my goal is to render a 2D image with "movement/effect" on some object lets call it XX (facing the camera in the game) , i thought about two ways to so :

1- apply the 2D image as a material to some mesh and render it before XX , but then how can i apply the "movement/effect" to the image - movement can be like RippleFX .

2- render to a texture as RippleFX , this i couldn't do , i tried the render to texture tutorial and i added the code :

Code:
void RenderToTexture()
{
   Int tex_size=256;

   // create the Render Target Texture if it hasn't been created yet
   if(!rtt.is())rtt.create(tex_size, tex_size, 1, IMAGE_B8G8R8A8, IMAGE_RT, 1);
  
   // render to texture
   Renderer.target=&rtt; // specify custom render target
   Renderer(Render);     // perform rendering

   D.clear(TURQ);
   D.fxBegin();             // start drawing to helper screen
   D.clearCol();
   logo->drawFs();          // image draw
   ImageRTPtr fx=D.fxEnd(); // restore default screen drawing, and access the helper screen
   // set ripple effect values
   RippleFx ripple;
   ripple.alpha_add  = fx_time;
   ripple.alpha_scale=-1;
   // draw helper screen with ripple effect
   ripple.draw(*fx);
  
   Renderer.target=null; // disable custom render target
}

but the texture drawn black with nothing .
i tried moving the code indside the draw and render functions same result .

can you help please , thanks .
05-22-2016 06:15 AM
Find all posts by this user Quote this message in a reply
Post Reply