PDA

View Full Version : Need help getting RayCast node to work



jrandom
02-22-2013, 12:26 AM
I'm trying to do some coloring/masking based on the closeness of one face to another, but my attempt is returning mostly "ray did not hit anything" (-1.0, colored blue here via gradient). If anything, the gradient settings I used should be coloring quite a bit of this scene green. (I was planning on adjusting the gradient to a proper scale once I got the basic RayCast working.)

I tried various transforms on Spot Info's 'normal' outputs, to no avail. Does anyone know how to get RayCast to work?

111824

Sensei
02-22-2013, 03:37 AM
I showed this in one of How To Control Reflection Tutorials IIRC
http://forums.newtek.com/showthread.php?129575-TrueArt-LightWave-Tutorial-How-To-Control-Reflection-Full-HD-video
http://forums.newtek.com/showthread.php?129613-TrueArt-LightWave-Tutorial-How-To-Control-Reflection-FullHD-video-2-for-professionals
I guess so second one.

RebelHill
02-22-2013, 04:56 AM
Lemme guess... thats a displaced mesh right? If so then I think ull find its simply that the whole thing is being evaluated BEFORE displacement. Cant say for certain off the top of my head, but I think changing the displacement order of the mesh should be what ur after.

jrandom
02-22-2013, 10:09 AM
I showed this in one of How To Control Reflection Tutorials IIRC
http://forums.newtek.com/showthread.php?129575-TrueArt-LightWave-Tutorial-How-To-Control-Reflection-Full-HD-video
http://forums.newtek.com/showthread.php?129613-TrueArt-LightWave-Tutorial-How-To-Control-Reflection-FullHD-video-2-for-professionals
I guess so second one.

Thanks! I'll go take a look



Lemme guess... thats a displaced mesh right? If so then I think ull find its simply that the whole thing is being evaluated BEFORE displacement. Cant say for certain off the top of my head, but I think changing the displacement order of the mesh should be what ur after.

It started out life as a displaced Sub-D mesh, yes, but I froze that to a regular mesh and then reduced polys on it. The original was ungodly unwieldy to work with directly -- 10km x 10km at a 10-meter resolution.

jrandom
02-22-2013, 10:35 AM
Hrm... so those videos show how to cast a ray in the reflection direction, but I'm not looking for that. What I want is the direction indicated by the geometry normal (or if possible, the normal of the surface after bump-mapping is applied) of the surface at that spot, regardless of viewing angle. If you look at my screenshot above, that's what I've attempted to do, but the result I'm getting is "cast ray hit no objects", hence my confusion.

Sensei
02-22-2013, 10:53 AM
Hrm... so those videos show how to cast a ray in the reflection direction, but I'm not looking for that.

I just wanted to show you how to use Ray Trace and Ray Cast nodes in really working example.
Knowing how they work you can adjust to your needs.


What I want is the direction indicated by the geometry normal of the surface at that spot, regardless of viewing angle. If you look at my screenshot above, that's what I've attempted to do, but the result I'm getting is "cast ray hit no objects", hence my confusion.

In your empty space normals are usually pointing up, you don't have there objects, so it's returning -1.0..

You should create key at 0.0 (between -1.0 and 0.0 there will be no single returned length).

And you hide what is done later with that gradient color..

jrandom
02-22-2013, 11:02 AM
I just wanted to show you how to use Ray Trace and Ray Cast nodes in really working example.
Knowing how they work you can adjust to your needs.

Yep (and what you did with those was pretty awesome). But here's the thing... the way you used RayCast indicates it works exactly how I thought it works. Hrm.



In your empty space normals are usually pointing up, you don't have there objects, so it's returning -1.0..

You should create key at 0.0 (between -1.0 and 0.0 there will be no single returned length).

And you hide what is done later with that gradient color..

Argh, I feel so dumb here. Okay, so the gradient color is just to let me test that I'm getting varying ray lengths -- it's not part of the final use case.

Now... you say the empty space normal points up, but what about the surface that the viewing ray hits? Shouldn't that be an actual direction? As far as I can tell, taking the World Position of the spot and casting out from the normal of the surface hit should get me positive distances for any ray that isn't cast out to the sky. There's lots of those mountains so a lot of the polys at the base of the mountains should be green (and not just that one splotch).

And uh... what do you mean by create a key?

Would it help if I posted the scene here? (It's on my home computer so I won't be able to do that until later today.)

Sensei
02-22-2013, 11:06 AM
111831

111832

-1.0 ray flies to environment/backdrop color would be returned by ray-tracing in such case.

0.0 gradient key is green.
>0.0 purple key to show max distance.

jrandom
02-22-2013, 11:10 AM
Will do. I'll get home in... seven hours. Stupid day job sucking up all my time...

(Of course, it's that very same stupid day job that paid for my 12 cores and 64GB of RAM...)

jrandom
02-22-2013, 06:34 PM
Here's my scene:

Sensei
02-23-2013, 04:31 AM
Spot Info > Normal is using original surface normal, not perturbed.. What you plug to material node is LOCAL.

111862

Looks similar, if not the same:

111863

jrandom
02-23-2013, 09:05 AM
Whoops, forgot to unhook the bump map before packing up the scene. Wait a sec... does this mean that the raycast node in my scene works fine, but that nearly all my normals hit sky?