About Store Forum Documentation Contact



Post Reply 
Lightmap in forward/simple renders
Author Message
Shatterstar Offline
Member

Post: #1
Lightmap in forward/simple renders
Lightmap in forward/simple renders
I saw where this is comming up in the road map.
Right now, I have been creating my lightmap images with blender and exporting to gimp and then importing to Esenthel. this technique has been good for me.
However, I am very interested as to what you have planned for Lightmaps. does this mean i will be able to create lightmaps within the Esenthel Model Editor? That would be awesome and interesting at the same time. So, what does Lightmap in forward/simple renders mean?
01-07-2013 09:46 PM
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #2
RE: Lightmap in forward/simple renders
I did this feature request (6 months ago) but esenthel is busy with EE 2.0.
http://www.esenthel.com/community/showth...p?tid=5273

Right now lightmaps only work in deferred mode, that means you can't use lightmaps for mobile applications (my case) since they use simple or forward renders modes. I've tried to code a shader for simple mode but always getting black texture.

I am going to share it, but doesn't work, I don't know why, looks like Tex(Lum, LightTex).rgb is always (0,0,0).

Code:
/******************************************************************************/
// VERTEX SHADER
/******************************************************************************/
void VS
(
   // vertex input
   VtxInput vtx,

   // output
   out Vec4 oPos:POSITION,
   out Vec2 oDiffuseTex:TEXCOORD0,
   out Vec2 oLightTex:TEXCOORD1

)
{
   oDiffuseTex=vtx.tex(); // copy output texture coordinates
   oLightTex=vtx.tex1();
   Vec view_space_pos=          TransformPos(vtx.pos4()) ; // transform input mesh vertex position by 'object/camera matrix' to view space
   Vec view_space_nrm=Normalize(TransformDir(vtx.nrm ())); // transform input mesh vertex normal   by 'object/camera matrix' to view space and normalize it

   oPos=Project(view_space_pos); // return output position transformed by projection matrix
}
/******************************************************************************/
// PIXEL SHADER
/******************************************************************************/
Vec4 PS
(
   Vec2 DiffuseTex:TEXCOORD0,
   Vec2 LightTex:TEXCOORD1
):COLOR
{
    Vec diff;
    Vec light;

    // Get the pixel color form the color texture.
    diff = Tex(Col, DiffuseTex).rgb * MaterialColor().rgb;

    // Get the pixel color from the light map.
    light = Tex(Lum, LightTex).rgb;

    Flt alpha=1.f;

    return Vec4(diff*light,alpha);
}
/******************************************************************************/
// TECHNIQUE
/******************************************************************************/
TECHNIQUE(Main, VS(), PS());

You can learn more about renderer modes here:
http://www.esenthel.com/wiki/index.php?title=Renderers

You will not be able to create lightmaps with Esenthel editor.

PD: We are also using blender to create lightmaps.

IRC: irc.freenode.net
Channel: #Esenthel
(This post was last modified: 01-08-2013 01:18 AM by cmontiel.)
01-08-2013 01:12 AM
Find all posts by this user Quote this message in a reply
Shatterstar Offline
Member

Post: #3
RE: Lightmap in forward/simple renders
lol...thanks for explaining that to me. I'm a 3d modeler, so there are alot of things about making games that i just don't know. I have a programmer. I could have asked him, but he was busy with real world stuff. and so i had to ask. If you ever want to share programming knowledge with my programmer, his name is phleshdef on here. thanks and goodluck
01-08-2013 11:23 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Lightmap in forward/simple renders
I don't remember if lum texture is set automatically for the simple rendering phase. I'll check that
01-15-2013 10:32 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Lightmap in forward/simple renders
In the next SDK lightmap texture will be set correctly for RM_SIMPLE mode and you can access it from the shader
01-15-2013 11:11 AM
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #6
RE: Lightmap in forward/simple renders
Ok thx, I will try it with next SDK.

IRC: irc.freenode.net
Channel: #Esenthel
01-15-2013 02:31 PM
Find all posts by this user Quote this message in a reply
Post Reply