PDA

View Full Version : question about dynamic texture effect

 Phlok01-07-2011, 03:52 PMMaybe I've got a thinking blocade- but I desperately need some input with that: I've got a particle system and polySphere (or any other kind of polygonal geometry). If a particle collides with that object, I retrieve the UV coordinate of this collision. Right at this coordinate, I want a circle to appear- just as if I there was a ramp texture, set to circular and having that circle's center right at the position of the particle's collision. I really don't have the slightest idea how to get there...any hints, ideas, recommendations are very much appreciated.
Phlok
01-07-2011, 05:16 PM
Ok, I managed to get a bit further. The Ramp Texture Circle is right at the middle of the texture (@0.5, 0.5) and I read the collisionU and collisionV of the particles.

Then I set a bias of 0.5 (plus or minus, depending on the the collisionU or CollisionV value) to the collU/ collV values and feed that into the ramp's place2dTexture node's TranslateFrame.

The RBD expression looks the following:

proc float vice(float \$fl) {
\$fl = \$fl - 0.5;
return \$fl;
}
proc float versa(float \$fl)
{
\$fl = 0.5 - \$fl;
return \$fl;
}

/*********************

float \$colU;
float \$colV;
if(nParticleShape1.collisionU >= 0)
{
\$colU = nParticleShape1.collisionU;
\$colV = nParticleShape1.collisionV;
// print(\$colU + ", " + \$colV + "\n");

if(\$colU > 0.5)
{
\$colU = vice(\$colU);
}
else
{
\$colU = versa(\$colU);
}

if(\$colV > 0.5)
{
\$colV = vice(\$colU);
}
else
{
\$colV = versa(\$colV);
}

place2dTexture2.translateFrameU = \$colU;
place2dTexture2.translateFrameV = \$colV;
}

It is working basically but there's still a small translation between the circle and the impact point, still I cannot find it.

Aikiman
01-11-2011, 02:32 AM
Use the offset value on the placement2D to dial in the exact location then let your code do the rest. I remember trying this out once and that solved my problem.

You can do this in SOuP too which doesnt require any code.

CGTalk Moderation
01-11-2011, 02:32 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.