PDA

View Full Version : General access to raytracing functions in Layout plugins



Pinkston3
06-27-2006, 05:34 PM
I was wondering if there is a way to access the raytracing functions from other Layout plugins besides the shader/volumetric/etc. plugins.

These functions would be really useful to probe a scene from within, say, a LightwaveGeneric plugin, but I can't think of a way to access the raytracing functions from there.

The kinds of tests I want to perform are for positioning objects, and thus aren't really associated with any of the per-pixel operations where the raytracing functions are typically available. And I don't see how I might pull this off right now.

Any ideas?

Thanks,
-Donnie Pinkston

carllooper
06-27-2006, 06:10 PM
Keeping in mind the following:

"Raytracing functions aren't valid in all contexts, since they depend on having information about the scene that may not always exist."

For example:


"When the Surface Editor renders its preview thumbnail, for example, it evaluates the active shaders, but in this previewing context, the rayCast and rayShade fields of the LWShaderAccess will be NULL."

And:

"Always ensure that raytracing function pointers are valid before using them."

Well, you could try cacheing a pointer (to the raytracing functions) from invocation of a plugin that gets such a pointer - and then try (re)using such from within the context of another plugin - so long as you test the pointer.

But it probably won't work. If it could - it probably would be available for those other contexts. But you never know.

"Raytracing functions aren't valid in all contexts, since they depend on having information about the scene that may not always exist."

Rendering optimisation is generally context sensitive.

Carl

Jarno
06-27-2006, 10:25 PM
Well, you could try cacheing a pointer (to the raytracing functions) from invocation of a plugin that gets such a pointer

Sure you can try doing that. You could also try writing random values to random memory locations. They will both give approximately the same result.

As you quoted, the raytracing functions depend on all sorts of info that simply does not exist outside of a render context.

Also do not cache the pointer to the raytracing functions. There is some housekeeping data associated with that pointer. By caching the pointer and using it somewhere else you're bound to thoroughly screw things up.

---JvdL---

carllooper
06-28-2006, 12:45 AM
Experimenting beyond the bounds of the sdk documentation is an interesting learning experience. I've cached pointers - ie. used them out of context - with success on a number of occasions. But there is no sdk support for such use and no sdk roadmap for such use. Which is sort of what I was trying to say - ie. give due warning but without ruling out completely the use of a cached pointers - because it is possible to use such.

But yes, using such is like driving a car blindfolded. Not for the feint hearted.

Carl