cmontiel
Member
|
Decal/Mesh Overlay alternative
Since RM_OVERLAY isn't been called in iOS (SIMPLE render mode), what alternatives do we have for drawing decals/meshOverlay??
I only need one decal to show character destination point.
IRC: irc.freenode.net
Channel: #Esenthel
|
|
10-20-2012 02:54 PM |
|
Zervox
Member
|
RE: Decal/Mesh Overlay alternative
RM_BLEND
|
|
10-20-2012 04:53 PM |
|
cmontiel
Member
|
RE: Decal/Mesh Overlay alternative
MeshOverlay.h :
Code:
// draw, 'MeshOverlay' should be drawn in each frame with the same 'Matrix' or 'CSkeleton' as the source 'mesh' from which 'MeshOverlay' has been created, drawing should be called only in RM_OVERLAY rendering mode, doesn't use automatic Frustum culling
So I can't use RM_BLEND for MeshOverlay.
I have tested RM_BLEND with Decal before posting, but nothing is displayed in iOS, only in Windows. And it isn't a bug, Decals aren't suported in SIMPLE render mode.
IRC: irc.freenode.net
Channel: #Esenthel
|
|
10-21-2012 01:53 AM |
|
Zervox
Member
|
RE: Decal/Mesh Overlay alternative
particles, manually placing images and draw them, does VI work? VI.image, VI.quad and set the vertex positions?
|
|
10-21-2012 02:17 AM |
|
cmontiel
Member
|
RE: Decal/Mesh Overlay alternative
Hmm interesting, I will try it on Monday, thx
IRC: irc.freenode.net
Channel: #Esenthel
|
|
10-21-2012 02:27 AM |
|
cmontiel
Member
|
RE: Decal/Mesh Overlay alternative
Particles => Acting like billboards (always facing the camera), not a decal.
Manually placing images => If you mean image.draw3D(), that's a pure billboard.
Vertex Index Buffer =>
I am using this code
Code:
Flt decal_size = 0.5f;
Image *img= Images.get("Gfx/Decals/tunelring_0.gfx");
VI.image(img);
Vec p1(Players[0].path_target + Vec(-decal_size,0,decal_size));
Vec p2(Players[0].path_target + Vec(decal_size,0,decal_size));
Vec p3(Players[0].path_target + Vec(decal_size,0,-decal_size));
Vec p4(Players[0].path_target + Vec(-decal_size,0,-decal_size));
Quad q;
q.set(p1,p2,p3,p4);
q.setNormal();
VI.quad(q);
VI.end();
Quad is displayed in the correct position and size, but totally black. Variable img != NULL. What am I doing wrong?
IRC: irc.freenode.net
Channel: #Esenthel
(This post was last modified: 10-22-2012 05:32 PM by cmontiel.)
|
|
10-22-2012 05:23 PM |
|
Zervox
Member
|
RE: Decal/Mesh Overlay alternative
you could try this.
Vtx3DTex v[4];
v[0].pos.set(m_offset.x*m_areasize , 0, m_offset.y*m_areasize ); v[0].tex.set(0, 1);
v[1].pos.set(m_offset.x*m_areasize , 0, (m_offset.y+1)*m_areasize); v[1].tex.set(0, 0);
v[2].pos.set((m_offset.x+1)*m_areasize, 0, (m_offset.y+1)*m_areasize); v[2].tex.set( 1, 0);
v[3].pos.set((m_offset.x+1)*m_areasize, 0, m_offset.y*m_areasize); v[3].tex.set( 1, 1);
VI.image(&image);
VI.face (v[0], v[1], v[2], v[3]);
VI.end ();
|
|
10-22-2012 06:05 PM |
|
Pherael
Member
|
RE: Decal/Mesh Overlay alternative
I trying to make decal in my mobile game, but I don't know what I doing wrong.
Zervox Wrote:v[0].pos.set(m_offset.x*m_areasize , 0, m_offset.y*m_areasize ); v[0].tex.set(0, 1);
v[1].pos.set(m_offset.x*m_areasize , 0, (m_offset.y+1)*m_areasize); v[1].tex.set(0, 0);
v[2].pos.set((m_offset.x+1)*m_areasize, 0, (m_offset.y+1)*m_areasize); v[2].tex.set( 1, 0);
v[3].pos.set((m_offset.x+1)*m_areasize, 0, m_offset.y*m_areasize); v[3].tex.set( 1, 1);
In code above m_offset is "decal" pos and m_areasize is "decal" size? Or I get something wrong? Because it isn't working for me, my "decal" jumps from one place to another when moving the camera. Please help.
|
|
08-24-2013 09:38 AM |
|
cmontiel
Member
|
RE: Decal/Mesh Overlay alternative
Are you calling SetMatrix(); ?
Code:
Renderer(RenderGame);
SetMatrix();
drawDecal();
|
|
08-24-2013 01:54 PM |
|
Pherael
Member
|
RE: Decal/Mesh Overlay alternative
Silly me ^^ Forgot something basic like this. cmontiel Thank you very much, apparently my brain is not working today.
|
|
08-24-2013 02:21 PM |
|
cat555
Member
|
RE: Decal/Mesh Overlay alternative
Hi, i'm trying to reach decal effect on Android with RM_BLEND... the solution proposed in this thread works Ok (thanks for sharing), but only works on flat worlds. How are you handling this on non-flat worlds?
Regards,
|
|
01-12-2014 03:52 AM |
|
Esenthel
Administrator
|
RE: Decal/Mesh Overlay alternative
You can use terrain heights (Game.World.hmHeight) or Physics ray casts to set Y positions of the vertices
|
|
01-12-2014 04:10 AM |
|
cat555
Member
|
RE: Decal/Mesh Overlay alternative
Hi Esenthel, thanks... works nicely
|
|
01-12-2014 05:10 PM |
|