![Smile :)](./images/smilies/icon_smile.gif)
Decal System / Manager
Re: Decal System / Manager
WoW! Only discovered this now, many thanks for sharing it. Will surely use this for my project. ![Smile :)](./images/smilies/icon_smile.gif)
![Smile :)](./images/smilies/icon_smile.gif)
-
- Competition winner
- Posts: 117
- Joined: Wed Jun 30, 2010 8:44 am
- Location: Portugal
- Contact:
Re: Decal System / Manager
From the first post, by RdR: "How to use"
Just in case, this could be an issue to anyone else... This line of code doesnt worked with me:
I had to change it, this way, seems to work fine now:
Thanks again, RdR, for share this ![Smile :)](./images/smilies/icon_smile.gif)
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);
Code: Select all
decalManager->("mydecal.png", position, dimension, normal, textureRotation, parent, lifeTime, distance);
Code: Select all
decalManager->addDecal("mydecal.png", position, dimension, normal, textureRotation, parent, lifeTime, distance);
![Smile :)](./images/smilies/icon_smile.gif)
Re: Decal System / Manager
Thanks for noticing, I will edit my start post.jorgerosa wrote: Just in case, this could be an issue to anyone else... This line of code doesnt worked with me:I had to change it, this way, seems to work fine now:Code: Select all
decalManager->("mydecal.png", position, dimension, normal, textureRotation, parent, lifeTime, distance);
Thanks again, RdR, for share thisCode: Select all
decalManager->addDecal("mydecal.png", position, dimension, normal, textureRotation, parent, lifeTime, distance);
Re: Decal System / Manager
Updated DecalSceneNode with Z-fighting fix, thanks to Lonesome Ducky.
Re: Decal System / Manager
Fixt some stuff in the DecalManager and added it to the IrrExt project
Re: Decal System / Manager
in revision of the trunk 4047 the pack_textureblendfunct will no longer compile
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
-- https://github.com/netpipe/Luna Game Engine Status 95%
Re: Decal System / Manager
That one got renamed (it missed the t before I think).tecan wrote:in revision of the trunk 4047 the pack_textureblendfunct will no longer compile
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
Re: Decal System / Manager
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!
Re: Decal System / Manager
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 (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](http://www.jacobwdesigns.com/upload/O4R2k0eW/example.png)
(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*>)
Thanks in advance!
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
Code: Select all
decals->addDecal(splat,btarget,core::vector3df(10,10,10));
![Image](http://www.jacobwdesigns.com/upload/O4R2k0eW/example.png)
(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*>)
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();
}
Re: Decal System / Manager
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?
Are you using the metaSelector in the above code for the decal manager ?
Could you create a screenshot with the wireframe of the decal?
Re: Decal System / Manager
Nope, I'm adding each wall and the floor nodes individually in a loop.
Here is the wireframe image:
![Image](http://jacobwdesigns.com/upload/O4R2k0eW/example2.png)
Here is the wireframe image:
![Image](http://jacobwdesigns.com/upload/O4R2k0eW/example2.png)
Re: Decal System / Manager
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?
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
Re: Decal System / Manager
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.
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.
Re: Decal System / Manager
Thats sounds about right indeed. Haven't checked this code in a while eitherchristianclavet 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.
![Very Happy :D](./images/smilies/icon_biggrin.gif)
You prob use the wrong normal, if you use the gun inverse direction it should be correct.
Re: Decal System / Manager
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
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