Skidmarks

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

I have tried several starting alpha values, thats not the probem. Now I tried DX9 too but no success. My video card is a pretty crappy GForce 2, could that be the problem (though I belive nothing special should be needed for this effect)?
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post by ProSoft »

My card here is a MX 440, 32MB and it works well. I will make a litle working example to send to you.
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post by ProSoft »

I forget to say. Try putting

setEnabled( true );

at end of code. For some reason i put a setEnabled( false ) at scenenode creation, then its not enabled automatically. If its not work, then i will put an example.
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

That wa one of the first things I tried :(

A working example would be great :P
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post by ProSoft »

I updated RibbonTrailSceneNode.zip at http://br.geocities.com/paulo_cmv/ with a working example, made over TerrainRendering Irrlicht sample. You can download it again for some testing.
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

The archive is corrupt but it still unpacked some files and trying to execute TerrainRendering.exe it says that I have to install .Net framework v 2.0.50727. I don't know if it is because of the missing files, that werent unpacked correctly, or am I missing something more :(
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post by ProSoft »

I compiled it with VC++ Express, maybe i forget to set something on compiler. I dont noticed, coz i have Net Framework installed :|

Youre right, file is corrupted. I will post it again tomorrow.

But its code have nothing special. You can get the code inside TerrainRendering.cpp and try to compile it by yourself. I have copied needed media inside dir. Irrlicht version is 1.1 but i think it will work with earlyer versions. Here its worked as expected.

One thing happen is that ribbon wil only be generated while scenenode move in space. If you dont move it, will never get visible. For this example i have set the node as child of camera, just in front. This way, when you move the camera, a ribbon is generated in front of camera, drawing the path you traveled. If you turn on the setShowDebug() or something, then you will see the varios boundingbox being created. Each boundingbox is frustrum-culled, for better FPS if you use large trails.
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

The last post was helpful and explained many things, now I got it to display something atleast! Will try to get it to work after school :P
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post by ProSoft »

I uploaded file again. Also ( i guess ) i eliminated the need for NET Framework. I was compiled with /clr :oops:

I have tested file download and now its ok.
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

Now I got it to display the skidmarks in the right place but still not quite the way I want. The problem is that the skidmarks get somehow oriented to an axis or something.. anyway driving one way, the skidmarks get displayed correctly but heading 90 degrees from that direction, the marks become 0px wide (the width decreases more and more headed to that direction).

To explain better, here are some images (notice how it is of correct width horisontally and decreases to nothing vertically):

Image
Image

Any thoughts?
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post by ProSoft »

The way its looking, appears that you are moving the node, but not rotating it with the car. Remember the quads are created aligned btw Point1 and Point2, two vectores RELATIVE to scenenode. In demo i sent, i know this problem occur, probably coz the camera dont pass rotation to its childs ( camera getRotation() returns always 0,0,0 ). Anyway, ill take a closer look in my code...
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

I made the car body node as the parent for testing, so there should be rotation available. Also I tried setting the rotation of the skidmarks node manually on every frame but that didn't change anything either.

This is what I'm using:

Code: Select all

	video::ITexture* tex = game->getVDriver()->getTexture("textures/skid.jpg");

	skidtrail = new RibbonTrailSceneNode(game->getIDevice(), node, -1);
	skidtrail->setPosition(core::vector3df(0.0f, 0.0f, 0.0f));
	skidtrail->setMaterialTexture(0, tex);
	skidtrail->setPoint1(core::vector3df(0.25f, -0.2f, 0.0f));
	skidtrail->setPoint2(core::vector3df(-0.25f, -0.2f, 0.0f));
	skidtrail->setMaxDistance(0.5f);
	skidtrail->setMaxQuads(10000);
	skidtrail->setStartingAlpha(100);
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post by ProSoft »

I have made some tests here. The problem you having is more a conceptual problem i will try to solve. As you know, quads are created by a line starting from Point1 to Point2. This line orientation is fixed to scenenode rotation. Then when your car run in right line, node will create correct skidmarks. When your car slide laterally, nodes will show wrong.
I will try to change something in my code. I guess i need a better math to calc vertex positions. If you have a good idea, please tellme ;)

Maybe the simplest way to solve this is store the current position of node, then in the next step, orient node to view in oposite direction from stored position, instead of orienting it with vehicle node.
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

Looking forward to improvments. Tried some possibilities myself too but could not get a decent result :lol:
kallaspriit
Posts: 27
Joined: Thu Sep 15, 2005 3:22 pm

Post by kallaspriit »

Any progress on the problem? :(
Post Reply