BMText fails to render after r1838

Problems building or running Ardor3D, questions about how to use features, etc.

BMText fails to render after r1838

Postby martifa » Tue Apr 24, 2012 6:13 am

Hi!

I have a scene with box like objects with labels on them. The boxes are loaded as Collada models and the labels are BMText objects. After revision 1838 in the Ardor3D trunk the labels disappear. I have found that one line in AbstractRenderBucket makes the difference. The code with the included diff works:
Code: Select all
@@ -135,7 +135,8 @@
         final Camera cam = Camera.getCurrentCamera();

         if (spat.getWorldBound() != null && Vector3.isValid(spat.getWorldBound().getCenter())) {
-            spat._queueDistance = spat.getWorldBound().distanceToEdge(cam.getLocation());
+//            spat._queueDistance = spat.getWorldBound().distanceToEdge(cam.getLocation());
+            spat._queueDistance = cam.getLocation().distance(spat.getWorldBound().getCenter());
         } else {
             final ReadOnlyVector3 spatPosition = spat.getWorldTranslation();
             if (!Vector3.isValid(spatPosition)) {
That is, when
Code: Select all
getWorldBound().distanceToEdge
is used the BMText objects turn invisible in the rendering.

As far as I can tell the BMText objects don't use a bounding volume so the else block is run for the BMText objects and the if for the box objects. If anyone can point me in the right direction I will be thankful! I have looked at this some hours now and can't seem to figure out what goes wrong...

Martin
martifa
regular
 
Posts: 67
Joined: Thu Sep 15, 2011 5:16 am

Re: BMText fails to render after r1838

Postby gouessej » Tue Apr 24, 2012 7:32 am

I don't reproduce your problem, I use a BMText very early in the introduction scene of TUER. I don't understand why the current code queues the distance between the spatial and the nearest edge.
gouessej
regular
 
Posts: 1186
Joined: Fri May 01, 2009 3:26 am
Location: France

Re: BMText fails to render after r1838

Postby martifa » Tue Apr 24, 2012 8:33 am

OK, thanks for trying!

I use a BasicText object to display the FPS on screen. That one is rendered in ortho mode and works well, but I have not tried replacing it for a BMText object. I should probably add that I use a texture renderer to render the scene with the disappearing labels, but I don't see why that should change things.

gouessej wrote:I don't understand why the current code queues the distance between the spatial and the nearest edge.


The code does not compute the distance between the spatial and the nearest edge but between the nearest edge of the bounding volume of the spatial and the location of the current camera, as opposed to the distance between the camera and the center of the bounding volume. I guess it is more precise. My BMText objects have blending enabled so they should be on the TransparentRenderBucket queue, while the boxes are on the Opaque queue. I don't understand what is going on...

Martin
martifa
regular
 
Posts: 67
Joined: Thu Sep 15, 2011 5:16 am

Re: BMText fails to render after r1838

Postby renanse » Tue Apr 24, 2012 2:20 pm

Is it possible you are running a visitor on your scene that sets the modelBound?
Gratitude is a mark of a noble soul and a refined character.
User avatar
renanse
Site Admin
 
Posts: 2955
Joined: Tue Oct 28, 2008 6:49 pm
Location: Austin, TX

Re: BMText fails to render after r1838

Postby martifa » Tue Apr 24, 2012 3:00 pm

If I would have to manually add a visitor the answer is no. If I've understood things correctly, the distance computed here is used to sort the render queues, right? And nothing should be culled based on these distances?
martifa
regular
 
Posts: 67
Joined: Thu Sep 15, 2011 5:16 am

Re: BMText fails to render after r1838

Postby renanse » Wed Apr 25, 2012 9:52 pm

Right, but for that line to affect things, either you somehow have a bounding volume on your bmtext, or your scene sorting has changed and something else is drawing in such a way as to cover up your text (perhaps depth test related.)
Gratitude is a mark of a noble soul and a refined character.
User avatar
renanse
Site Admin
 
Posts: 2955
Joined: Tue Oct 28, 2008 6:49 pm
Location: Austin, TX

Re: BMText fails to render after r1838

Postby martifa » Thu Apr 26, 2012 2:36 am

Sounds reasonable, thanks for the input!

I still have a bit of difficulties understanding how that line could cause my stuff to fail. Say I did add a bounding volume to the text and disabled depth testing. Wouldn't then the text always show because the only object that could cover it is opaque (the box) and would be rendered before the text which has blending enabled and thus is rendered after it on the transparent render bucket queue? I agree I probably am to blame in some way, I just have a hard time understanding what could cause this...

I will look into it and let you know what I find!

Martin
martifa
regular
 
Posts: 67
Joined: Thu Sep 15, 2011 5:16 am


Return to HELP!

Who is online

Users browsing this forum: No registered users and 0 guests

cron