Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: SortMeshList with partially opaque mesh material  (Read 375 times)
Craigomatic
Customers
Community Member
*****
Posts: 78


« on: July 02, 2008, 12:49:40 AM »

I'm using the Scene.SortMeshList to manage alpha sorting and it seems to work ok until I make one of the elements in the scene have an opacity value for its material:

Camera Position: -0.8,-0.71,-0.8
Camera Rotation: -0.04,0.12,-0.04 (radians)




There seems to be a few angles that are causing some weirdness in the sorting, here's a few screenies from different positions:

pos: 1.01,0.28 1.01 rot:0.35,-2.76,0.35


pos: -0.08 -0.2 -0.08 rot: 0.23,-0.01,0.23


pos: -2.87,-0.2 -2.87 rot: 0.33,1.85,0.33


pos: 2.69,-0.24,2.69 rot: 0.25,-1.91,0.25


pos: 3.04,-0.52,3.04 rot: 0.17,-1.48,0.17


To test further, I tried using Scene.RenderAllMeshes() and the alpha sorting does the same thing. I also tried with SetAlphaTest(true) rather than false which I normally use.
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #1 on: July 03, 2008, 01:25:22 PM »

I think the problem is that I'm using the mesh positions to sort by distance...and in some angles it's not ok.

You mean it works for texture with alpha? but not for material alpha? it's quite weird.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Craigomatic
Customers
Community Member
*****
Posts: 78


« Reply #2 on: July 03, 2008, 05:33:18 PM »

oops, sorry to be misleading, it also has the same issue on a texture with alpha.
Logged
jviper
Community Member
*
Posts: 1381

Discipline in training


« Reply #3 on: July 04, 2008, 12:53:19 AM »

I belive this is a depth test problem. The depth test's job is to remove pixels from rendering when they will not be vivsible because somthing is in front of it (blocked from you view). For each pixel, the distance from your camera is tested with the closest pixel already rendered. If it passes (that pixel is closer), it includes that pixel to be rendered and updates the depth-duffer. If it fails, it does not get processed and is omitted.
This works great if you assume everything is opaque, because you can never see through objects that are opeque. This does not work if you have areas that are reansparent, because this depth test does not take transparency into account. This is why if you have transparent objects, all the objects must be sorted back (farthest way) to front (closest), so that anything behind something transparent has a chance to render.
An alternative would be to write your own depth-testing algorthim that includes transparency. Otherwise you'll have to do depth-peeling. This is an issue your going to run into no matter what rendering engine you use.
Logged

JAbstract.....Don't just imagine, make it happen!
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks