Raytracing Perspective Glitches?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/05/2005 at 05:09, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.5 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Morning!

    I'm currently testing a few shader ideas out using the TraceGeometry command in the VolumeData struct, but am having some weird results. When I transform the current ray for objects near the camera they seem skewed like the scene is being viewed thru a fish-eye lens! Is this a perspective effect, and has anyone experienced this at all?

    Ta

    Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/05/2005 at 01:14, xxxxxxxx wrote:

    no, haven´t experienced this yet.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/05/2005 at 02:35, xxxxxxxx wrote:

    Oh, ok. Might be something to do with the way I'm transforming the ray I guess?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/05/2005 at 06:06, xxxxxxxx wrote:

    Without some more information we'd all be guessing ;-) maybe you could post a code snip or at least what transform you are doing to the ray.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/05/2005 at 07:40, xxxxxxxx wrote:

    Hi David

    I maybe be doing something really stupid when transforming the ray, perhaps my 3d maths need polishing up a bit! I'll probably need to go into some depth to explain what is going wrong, and you contactable? Or could you mail me please?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/05/2005 at 07:49, xxxxxxxx wrote:

    You would be better off posting here, this way someone with the right experience might know an answer plus it helps everyone else if they come across a similar problem.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/05/2005 at 10:24, xxxxxxxx wrote:

    Ok fair enough. Basically to summarise in a reasonable amount of code ...

    The code below gets the current ray, transforms it to another objects inverted global matrix (got using ->GetMg), then checks whether the new ray intersects or not (so if hit, col=white, else col=black) - see below :

    [CODE}
    Ray *ray, invray;

    ray = vd->ray;
    Vector pos = SV(ray->p);
    Vector dir = SV(ray->v);
    Vector newpos = globalMat * pos;
    Vector newdir = globalMat * dir;
    invray.p = LV(newpos);
    invray.v = LV(newdir);

    vd->TraceGeometry(&invray;, MAXREAL, 0, &p;, &n;, &hit;);

    if(hit)
    vd->col = Vector(1.0, 1.0, 1.0);
    else
    vd->col = Vector(0.0, 0.0, 0.0);

    ...
    {/CODE]

    Does this help explain whats going wrong at all?

    Cheers ...



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/05/2005 at 08:37, xxxxxxxx wrote:

    Hi

    direction vectors are usually transformed by
    newdir = dir^globalMat;
    This omits the translation.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/05/2005 at 09:15, xxxxxxxx wrote:

    Cheers Michael, will give that a go ...



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/05/2005 at 01:30, xxxxxxxx wrote:

    Wow! That worked like a treat. Still a little bit of weirdness going on in the distance, but probably my maths!!

    Excellent Michael, thanks!


Log in to reply