About Store Forum Documentation Contact



Post Reply 
Decal/Mesh Overlay alternative
Author Message
cmontiel Offline
Member

Post: #1
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
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #2
RE: Decal/Mesh Overlay alternative
RM_BLEND
10-20-2012 04:53 PM
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #3
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
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #4
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
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #5
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
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #6
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
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #7
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
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #8
RE: Decal/Mesh Overlay alternative
Thank you zervox, it's working lol

IRC: irc.freenode.net
Channel: #Esenthel
10-22-2012 07:30 PM
Find all posts by this user Quote this message in a reply
Pherael Offline
Member

Post: #9
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
Find all posts by this user Quote this message in a reply
cmontiel Offline
Member

Post: #10
RE: Decal/Mesh Overlay alternative
Are you calling SetMatrix(); ?

Code:
Renderer(RenderGame);

SetMatrix();

drawDecal();
08-24-2013 01:54 PM
Find all posts by this user Quote this message in a reply
Pherael Offline
Member

Post: #11
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
Find all posts by this user Quote this message in a reply
cat555 Offline
Member

Post: #12
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #13
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
Find all posts by this user Quote this message in a reply
cat555 Offline
Member

Post: #14
RE: Decal/Mesh Overlay alternative
Hi Esenthel, thanks... works nicely smile
01-12-2014 05:10 PM
Find all posts by this user Quote this message in a reply
Post Reply