THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/10/2007 at 07:16, xxxxxxxx wrote:
Hallo,
ok mabe I should ask more precise questions! What I am trying to do is to write a plugin that is capable of generating the initial rays for each image pixel. (For a perspective camera this would be a ray originating at the camera center with a directional component pointing from the camera center towards the pixel position in the 3D scene frame.) The first question then would be: Is it possible to write a plugin which is only changing this part of the raytracing process? Meaning that the plugin does not have to trace any rays and generate any fragment information?
If this is possible: is a VideoPostPlugin the right plugin type? I assumed so because of the VIDEOPOST_CUSTOMLENS return type of the GetRenderInfo() method of the VideoPostData class. From there the SDK reference led me to the point that after setting this return type, the plugin can provide (its own?!) rays. The reference states that this is done by means of sending a Message with the type MSG_VIDEOPOST_CREATERAY and a pointer to the data of a Struct type named VideopostCreateRay. At this point I am not sure about several things:
- For which object do I call the Message method or "to whom do I send the message?"
- Where/when do I have to send the ray(s) (Execute or ExecutePoint)?
- Where is the ray data stored that is send, or do I have to allocate the ray(s) in free mem?
.
What I did to try some things out was to implement a VideoPost plugin that is reading out the ray data from the VolumeData and writing it onto the console. The plugin code (without the 'default' class declaration) looks like this:
> _
> /* Class declaration
> ...
> */
> void RayReadOut::
> PrintOpticalRay(VideoPostStruct* vps, LONG x, LONG y)
> {
> Ray ray;
> vps- >vd->GetRay(x, y, &ray;);
> std::stringstream output;
> output<<"("<<x<<", "<<y
> <<") : ("<<ray.p.x<<","<<ray.p.y<<","<<ray.p.z
> <<") -> ("<<ray.v.x<<","<<ray.v.y<<","<<ray.v.z<<")";
> String dbgstr(output.str().c_str());
> GePrint(dbgstr);
> }
>
> LONG RayReadOut::
> Execute(PluginVideoPost *node, VideoPostStruct *vps)
> {
> //execute when entering inner processing
> if(vps->open && vps->vp==VP_INNER) {
>
> GePrint(" -= RayReadOut::Execute =- ");
>
> RayParameter *ray = vps->vd->GetRayParameter(); // only in VP_INNER & VP_RENDER
>
> //get current image region
> LONG xMin,yMin,xMax,yMax;
> xMin = ray->left;
> yMin = ray->top;
> xMax = ray->right;
> yMax = ray->bottom;
>
> //print optical rays passing through image region corners to console:
> PrintOpticalRay(vps, xMin, yMin);
> PrintOpticalRay(vps, xMin, yMax);
> PrintOpticalRay(vps, xMax, yMax);
> PrintOpticalRay(vps, xMax, yMin);
>
> }
> return RAY_OK;
> }
> _
Activating this 'ReadOut' plugin when rendering through a parallel projection camera, which is positioned at the scene origin and having all rotation angles set to zero, delivers reasonable ray data for the corner pixels. The moment I activate my plugin which returns VIDEOPOST_CUSTOMLENS through GetRenderInfo() all rays aquired origin in (0,0,0) and point to (0,0,0). I tried all types of passing rays through messages I could think of (like in my previous post), but nothing changes this behaviour.
I'm grateful for any help!
Bogumil