cmontiel
Member
|
Lightmaps for RM_SIMPLE
Thanks esenthel for the last sdk update. This is a custom shader for lightmaps + alpha test on RM_SIMPLE renderer mode.
Code:
#include "Main.h"
/******************************************************************************/
// VERTEX SHADER
/******************************************************************************/
void VS
(
// vertex input
VtxInput vtx,
// output
out Vec4 oPos:POSITION,
out Vec2 oDiffuseTex:TEXCOORD0,
out Vec2 oLightTex:TEXCOORD1
)
{
oDiffuseTex=vtx.tex();
oLightTex=vtx.tex1();
oPos=Project(TransformPos(vtx.pos4()));
}
/******************************************************************************/
// PIXEL SHADER
/******************************************************************************/
Vec4 PS
(
Vec2 DiffuseTex:TEXCOORD0,
Vec2 LightTex:TEXCOORD1
):COLOR
{
// Alpha test
if(Tex(Col, DiffuseTex).a<1.f-MaterialColor().a)
discard;
// Diffuse texture color * Material Color * Lightmap color
return Vec4(Tex(Col, DiffuseTex).rgb * MaterialColor().rgb * Tex(Lum, LightTex).rgb,1.f);
}
/******************************************************************************/
// TECHNIQUE
/******************************************************************************/
TECHNIQUE(Main, VS(), PS());
/******************************************************************************/
And the screenshots:
iOS
Android
Both running at 60 fps.
IRC: irc.freenode.net
Channel: #Esenthel
|
|
01-29-2013 10:21 PM |
|
Esenthel
Administrator
|
RE: Lightmaps for RM_SIMPLE
Cool screen.
You've motivated me into adding lightmap support for all renderers in next SDK
|
|
02-01-2013 06:02 PM |
|
cmontiel
Member
|
RE: Lightmaps for RM_SIMPLE
Haha nice!
IRC: irc.freenode.net
Channel: #Esenthel
|
|
02-01-2013 06:17 PM |
|