Decal System / Manager

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki

Re: Decal System / Manager

Postby ACE247 » Fri Oct 28, 2011 7:40 pm

WoW! Only discovered this now, many thanks for sharing it. Will surely use this for my project. :)
ACE247
 
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Decal System / Manager

Postby jorgerosa » Mon Nov 07, 2011 5:24 pm

From the first post, by RdR: "How to use"
cpp Code: Select all
 
// Create decal manager
DecalManager* decalManager = new DecalManager(smgr);
 
// Set terrain and add some meshes where decals can be placed
decalManager->setTerrain(terrain);
decalManager->addMesh(wallNode);
decalManager->addMesh(rockNode);
 
// Create a decal
irr::core::vector3df position = irr::core::vector3df(123, 10, 123);     // Position to place the decal
irr::core::vector3df dimension = irr::core::vector3df(2, 2, 2);         // Dimension of decal
irr::core::vector3df normal = irr::core::vector3df(0, 1, 0);            // Orientation of the decal
irr::f32 textureRotation = 45;                                          // Rotation in degrees
irr::scene::ISceneNode* parent = 0;                                     // Parent
irr::f32 lifeTime = 0;                                                  // Time to life
irr::f32 distance = 250;                                                // Max viewing distance
 
decalManager->("mydecal.png", position, dimension, normal, textureRotation, parent, lifeTime, distance);
 

Just in case, this could be an issue to anyone else... This line of code doesnt worked with me:
cpp Code: Select all
decalManager->("mydecal.png", position, dimension, normal, textureRotation, parent, lifeTime, distance);

I had to change it, this way, seems to work fine now:
cpp Code: Select all
decalManager->addDecal("mydecal.png", position, dimension, normal, textureRotation, parent, lifeTime, distance);


Thanks again, RdR, for share this :)
User avatar
jorgerosa
Competition winner
 
Posts: 104
Joined: Wed Jun 30, 2010 8:44 am
Location: Portugal

Re: Decal System / Manager

Postby RdR » Mon Nov 07, 2011 9:35 pm

jorgerosa wrote:Just in case, this could be an issue to anyone else... This line of code doesnt worked with me:
cpp Code: Select all
decalManager->("mydecal.png", position, dimension, normal, textureRotation, parent, lifeTime, distance);

I had to change it, this way, seems to work fine now:
cpp Code: Select all
decalManager->addDecal("mydecal.png", position, dimension, normal, textureRotation, parent, lifeTime, distance);


Thanks again, RdR, for share this :)


Thanks for noticing, I will edit my start post.
User avatar
RdR
Competition winner
 
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm

Re: Decal System / Manager

Postby RdR » Thu Nov 24, 2011 8:57 pm

Updated DecalSceneNode with Z-fighting fix, thanks to Lonesome Ducky.
User avatar
RdR
Competition winner
 
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm

Re: Decal System / Manager

Postby RdR » Sun Feb 12, 2012 12:38 pm

Fixt some stuff in the DecalManager and added it to the IrrExt project
User avatar
RdR
Competition winner
 
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm

Re: Decal System / Manager

Postby tecan » Tue Feb 21, 2012 4:37 am

in revision of the trunk 4047 the pack_textureblendfunct will no longer compile
Live long and phosphor!
-- https://github.com/tecan/Luna Status 85%
User avatar
tecan
 
Posts: 345
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada

Re: Decal System / Manager

Postby CuteAlien » Tue Feb 21, 2012 9:23 am

tecan wrote:in revision of the trunk 4047 the pack_textureblendfunct will no longer compile

That one got renamed (it missed the t before I think).
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8352
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Decal System / Manager

Postby christianclavet » Sat Mar 17, 2012 2:51 am

Humm! Did not notice this before today! Good job! I think I will use this for projecting "blob" shadows on the ground in my project. Really nice work!
User avatar
christianclavet
 
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA

Re: Decal System / Manager

Postby arascii » Sun Mar 24, 2013 6:26 pm

This is a really cool system, thank you for providing it. I'm running into this strange error and I was hoping you could help me with it.
I am using scaled/rotated/textured cubeSceneNodes as walls in a simple 3d game. When I shoot a bullet, I use ray tracing to keep the point of intersection with scene objects, and when the bullet hits the object I'm using
cpp Code: Select all
decals->addDecal(splat,btarget,core::vector3df(10,10,10));
(obviously, the texture is splat, btarget is the intersection point). This works fine on my "floor" object, which is an IMeshSceneNode of a HillPlaneNode. But when I fire a bullet at a "wall" node I get the following:
Image
(I included the splat on the floor for reference, the problem is on the wall).
Any ideas why this could be happening? Here is how I'm adding the walls to the decal manager:
(walls is a core::array<IMeshSceneNode*>)
cpp Code: Select all
 
for (int i=0; i<walls->size(); ++i)
    {
        scene::IMeshSceneNode* w = (*walls)[i];
        decals->addMesh(w->getMesh(),w);
        w->setMaterialFlag(video::EMF_FOG_ENABLE, true);
        scene::ITriangleSelector* wallSelector = smgr->createTriangleSelectorFromBoundingBox(w);
        w->setTriangleSelector(wallSelector);
        metaSelector->addTriangleSelector(wallSelector);
        wallSelector->drop();
    }
 

Thanks in advance!
arascii
 
Posts: 3
Joined: Sun Mar 24, 2013 6:14 pm

Re: Decal System / Manager

Postby RdR » Mon Mar 25, 2013 9:44 am

Hey arascii,

Are you using the metaSelector in the above code for the decal manager ?
Could you create a screenshot with the wireframe of the decal?
User avatar
RdR
Competition winner
 
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm

Re: Decal System / Manager

Postby arascii » Tue Mar 26, 2013 4:31 am

Nope, I'm adding each wall and the floor nodes individually in a loop.
Here is the wireframe image:
Image
arascii
 
Posts: 3
Joined: Sun Mar 24, 2013 6:14 pm

Re: Decal System / Manager

Postby arascii » Sun May 19, 2013 12:46 am

Haven't heard anything about this in a while. I may have to move away from Irrlicht if I can't fix this issue. Any suggestions, anyone?
arascii
 
Posts: 3
Joined: Sun Mar 24, 2013 6:14 pm

Re: Decal System / Manager

Postby christianclavet » Mon May 20, 2013 12:34 pm

For me this look like a UV stretching issue with the decal projection.

I havent checked the source of this yet, but can you try changing the orientation of the decal? I see this as a parameter now and the parameter orientation is from the top. (The parameter ask for an orientation vector) It's good for the floor but bad for the wall. (Would surely cause that stretching).

You should try to use a "ray" (weapon projectile) direction instead. Are you using your "gun reticle" to get the collision point with the object? You could use the orientation of this ray for the orientation vector.
User avatar
christianclavet
 
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA

Re: Decal System / Manager

Postby RdR » Tue May 21, 2013 8:38 pm

christianclavet wrote:For me this look like a UV stretching issue with the decal projection.

I havent checked the source of this yet, but can you try changing the orientation of the decal? I see this as a parameter now and the parameter orientation is from the top. (The parameter ask for an orientation vector) It's good for the floor but bad for the wall. (Would surely cause that stretching).

You should try to use a "ray" (weapon projectile) direction instead. Are you using your "gun reticle" to get the collision point with the object? You could use the orientation of this ray for the orientation vector.


Thats sounds about right indeed. Haven't checked this code in a while either :D
You prob use the wrong normal, if you use the gun inverse direction it should be correct.
User avatar
RdR
Competition winner
 
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm

Re: Decal System / Manager

Postby Granyte » Sat Jan 11, 2014 9:00 pm

I have just integrated this to my game and while it looks great the performance can quite fast become terrible when I have a lot of object colliding.

so I was wondering how does the decal manager make use of the batching and if it could be improved further by batching and using shaders to move the decals group to their proper meshes
Granyte
 
Posts: 846
Joined: Tue Jan 25, 2011 11:07 pm

PreviousNext

Return to Project Announcements

Who is online

Users browsing this forum: No registered users and 1 guest