[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29593] branches/render25/source/blender/ render/intern/raytrace/rayobject.cpp: Render Branch: fix bug raytracing instanced objects with use instancing

Brecht Van Lommel brecht at blender.org
Tue Jun 22 12:08:28 CEST 2010


Hi,

This was my own mistake refactoring some code, accidentally switched
the order of some lines of code. We're not benefiting much from last
hit optimization here, the ao/env/indirect rays need the closest hit.
Maybe I should try using it to shorten the rays before doing the bvh
traversal, though not sure how helpful it would be in practice.

Brecht.

On Tue, Jun 22, 2010 at 1:04 AM, André Susano Pinto
<andresusanopinto at gmail.com> wrote:
> Hmm bretch was this a bug that only shows up when instances are used and
> they are not enabled for rendering?
>
> If that then I guess you are using instances besides the DUPLI_VERTS and
> stuff...
> which makes me think you might be using it to transform the whole scene or
> something like that.
>
> Please be aware that last_hit optimization is not very good when instances
> are in use.
> Namely it currently raytraces to the instanced rayobject closest to root
> that got last hit.
> If it doenst hits that object it then raytraces the whole scene (and during
> this step i think it doenst skips the already tested object).
>
> Which can be very bad (like raytracing the same ray twice) if you have the
> whole scene enclosed by an instance.
>
> Fix would be to store the actual primitive that got last_hit and also a
> transformation matrix to apply to a ray during that last_hit test...
> that would even allow to have instances inside instances and still have the
> last_hit test go directly to the last_hit primitive.
>
> I might implement it in a few days (i need it for a bug fix where I plan to
> use the instance to rotate the whole scene).
>
> --
> (andré goes back to study for boring exams >.<)
>
> On 21 June 2010 20:35, Daniel Salazar - 3Developer.com <zanqdo at gmail.com>wrote:
>
>> About this probably the raytracer instancing should be on by default,
>> I talked to Andre a while back about this and he told me the speed
>> impact of having the feature on when you don't really need it should
>> be unnoticeable. So maybe we need to do a couple of tests and if it
>> turns out not to have any negative effect on speed just enable it by
>> default? The huge benefits of using memory instancing when there are
>> instances on the scene are very worth it
>>
>> pura vida,
>> Daniel Salazar
>>
>>
>> On Mon, Jun 21, 2010 at 8:16 AM, Brecht Van Lommel <brecht at blender.org>
>> wrote:
>> > Revision: 29593
>> >
>> http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29593
>> > Author:   blendix
>> > Date:     2010-06-21 16:16:05 +0200 (Mon, 21 Jun 2010)
>> >
>> > Log Message:
>> > -----------
>> > Render Branch: fix bug raytracing instanced objects with use instancing
>> > disabled for the raytracer.
>> >
>> > Modified Paths:
>> > --------------
>> >    branches/render25/source/blender/render/intern/raytrace/rayobject.cpp
>> >
>> > Modified:
>> branches/render25/source/blender/render/intern/raytrace/rayobject.cpp
>> > ===================================================================
>> > --- branches/render25/source/blender/render/intern/raytrace/rayobject.cpp
>>       2010-06-21 11:43:28 UTC (rev 29592)
>> > +++ branches/render25/source/blender/render/intern/raytrace/rayobject.cpp
>>       2010-06-21 14:16:05 UTC (rev 29593)
>> > @@ -72,6 +72,8 @@
>> >
>> >  MALWAYS_INLINE void rayface_from_vlak(RayFace *rayface,
>> ObjectInstanceRen *obi, VlakRen *vlr)
>> >  {
>> > +       rayface_from_coords(rayface, obi, vlr, vlr->v1->co, vlr->v2->co,
>> vlr->v3->co, vlr->v4 ? vlr->v4->co : 0);
>> > +
>> >        if(obi->transform_primitives)
>> >        {
>> >                mul_m4_v3(obi->mat, rayface->v1);
>> > @@ -81,8 +83,6 @@
>> >                if(RE_rayface_isQuad(rayface))
>> >                        mul_m4_v3(obi->mat, rayface->v4);
>> >        }
>> > -
>> > -       rayface_from_coords(rayface, obi, vlr, vlr->v1->co, vlr->v2->co,
>> vlr->v3->co, vlr->v4 ? vlr->v4->co : 0);
>> >  }
>> >
>> >  RayObject* RE_rayface_from_vlak(RayFace *rayface, ObjectInstanceRen
>> *obi, VlakRen *vlr)
>> >
>> >
>> > _______________________________________________
>> > Bf-blender-cvs mailing list
>> > Bf-blender-cvs at blender.org
>> > http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>> >
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
>>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list