Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Rendering models with transparent parts


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 gchewood   Members   -  Reputation: 236

Like
0Likes
Like

Posted 21 July 2013 - 07:21 AM

Bit of a weird problem that I feel I should know the answer to.

 

I have a number of models that have transparent areas (e.g torn cloth, hair). I'm rendering them all with the same shader in XNA. Some of them appear correctly, others don't: the transparent areas 'overwrite' the pixels beneath them (like when you don't sort the depths of models with transparency). But given that it is within the same model (all uses a single texture), I'm not sure how to solve it. Why do some models render correctly and others don't?

I'm guessing it's just an accident that those polys happen to be rendered in a bad order.

Thoughts and solutions?

 

Thanks a lot. 



Sponsor:

#2 BigGiantHead   Members   -  Reputation: 183

Like
0Likes
Like

Posted 21 July 2013 - 07:38 AM

For sure this happens because of bad render order.

 

Usually if I want to make a transparent part of a model, I add it to a different subset, i.e., with a different texture. I think in this way you won't have a problem. If you add the parts with alpha and the opaque parts in the same texture probably you will have to reorder the polys each time you draw depending on the view which I don't think is a good idea.

 

And as you already mentioned you should sort the objects with alpha by depth and always remember to render them after the objects which are opaque.

 

Hopefully this helps you.

 

BGH


Co-Founder of Tesseract Interactive.

Check out our project Excubitor on http://excubitorgame.com and http://www.indiedb.com/games/excubitor


#3 gchewood   Members   -  Reputation: 236

Like
0Likes
Like

Posted 21 July 2013 - 09:59 AM

Thanks for the quick reply BigGiantHead (nice name)

 

I was hoping to find a solution that wouldn't need different textures. You suggested that on the same texture you'd have to constantly reorder the polys each time but this doesn't seem to be necessary with those models that are already working. I assume that just means that on those models, the transparent parts are in a different ModelMeshPart that is rendered later than the others (are they grouped like that?) If that's the case, how do you arrange them so they're rendered in the correct order?

 

Worst case scenario I might just be lazy and model polys around the transparent edges. I'm fairly low poly so it'd be manageable.



#4 BigGiantHead   Members   -  Reputation: 183

Like
0Likes
Like

Posted 21 July 2013 - 12:57 PM

Actually I don't know if it is even possible to order the polys with a reasonable computational overhead.

 

If you want to get good and robust results you render everything with alpha after the opaque models, and of course ordered by depth.

That's the way to be sure that your models are ordered in the right way. Even then. there might be some problems with particles for example, or with instanced objects.

 

I don't think you'll get good results if you render the whole model in one go. 

 

I'm curious, is it possible to see a screenshot from the model you are having problems with.

 

BGH


Co-Founder of Tesseract Interactive.

Check out our project Excubitor on http://excubitorgame.com and http://www.indiedb.com/games/excubitor


#5 gchewood   Members   -  Reputation: 236

Like
1Likes
Like

Posted 22 July 2013 - 01:17 AM

Well I've solved it. Not entirely sure what was going on but the behaviour of these transparent parts made had me speculating that there was just some simple material options that could fix it (and I was right).

I'm working in 3ds max. Separated the model into opaque and transparent models. Applied the same texture (in 2 dif instances) to each model and then recombined them. Problem solved, works fine.

I'm guessing this forced XNA to interpret the model as having 2 ModelMeshParts instead of 1?

Thanks for the input all the same!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS