LDraw.org Discussion Forums

Full Version: Partial transparent parts and "needs work" note's
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello all,

I was playing around (testing) in my dev versionof LDCad this weeked when I noticed this:

[Image: transparencyGlitch.png]

(You can look through the IR receiver)

In the header of 58123 BFC is enabled, so are the subparts, but then I noticed the comments in some of the subfiles ("Needs Work: inner side not modelled").

This made me think, my rendering loop is correct after all, but when I open the above little test ldr in LDView 58123 seems to be rendered without culling.

Am I missing something here? In short what's the (by authors) expected correct behavior here.
Yes, I know this might be a problem on this part (and some similar ones). But when I look at this part with LDView, the IR glass is MUCH darker and you simply can't see anything through it (alpha of color 32 is pretty high). Maybe the difference between LDview and LDCad is that you culled out back side of transparent part. The glass of the IR receiver has two sides, each ones attenuating light, precisely to decrease transparency. But yes, the only real solution would be to create an inner skin on this part... Some part authors are decidedly careless ;D
Yes I'm culling the backside of the transparent stuff away, that's the cause of it being more transparent. But if you turn on stipple and bfc info in LDView, you'll see the back side (now red) should be culled away, yet LDView doesn't.

[Image: irCulling.png]

I'm wondering why it's ignoring BFC. Because if it didn't it would look the same as in LDCad I think.

And taking all this into account: is the way LDView handles this part the favored way by part authors?

Do mind, I'm not complaining about this part. I'm happy with the way it is. Just wondering about the associated technical issues Smile
Travis correct me if I'm wrong but I think LDView turns off BFC for transparent colors.
With BFC enabled, I get the same effect in LDView that you see in LDCad. Here are my steps:
  • Disable "Process LDConfig.ldr" in LDView's preferences so that the IR glass isn't so dark.
  • Set LDView's background color to bright green.
  • Enable BFC (with red/green/blue faces disabled).
  • Load 58123.dat all by itself.
The green background clearly shows through.

Orion: LDView does indeed disable BFC for the transparent portions of the part, but not for the opaque portions of the part.
Ouch, for some reason I thought the 'BFC' button in LDView was for the red/green info only. So I didn't realize I've turned culling off altogether.

Turning culling off for transparent triangle/quads causes double blending, and as a result makes things less transparent. Is this 'wanted' behavior from renderers (by the color maintainers/part authors)?
The only way for BFC-certified transparent parts to look consistent with non BFC-certified transparent parts is if BFC is disabled during all transparent part drawing, so I chose to do that. Of course, I added BFC support to LDView over 6 and a half years ago, and there were a lot fewer BFC-certified parts then.

Whether or not it is "wanted" is anybody's guess, but I've never had anyone complain that LDView's transparency was too opaque. However, LDView does cheat on this a bit. The default alpha value (from ldconfig) is 128, and this gets mapped to 110 in LDView. Everything below 128 is interpolated such that 0-128 maps linearly from 0-110. Everything above is interpolated such that 128-255 maps linearly from 110-255.

Note that I chose the 110 value via empirical testing (with two-sided transparent surfaces) before having ldconfig.ldr support, so the mapping was my solution to 128 being the standard alpha for transparent parts in ldconfig.ldr.
Here's my mapping code (transA is hard-coded to be 110, and both alpha and transA are integers):
// This is a little odd, but we want 128 to map to our standard
// transparent alpha (transA), anything below transA to smoothly map
// from 0 to transA, and anything above transA to smoothly map from
// transA to 255.
if (alpha == 128)
    alpha = transA;
else if (alpha < 128)
    alpha = alpha * transA / 128;
    alpha = transA + (alpha - 127) * (255 - transA) / 128;
Roland Melkert Wrote:Turning culling off for transparent triangle/quads causes double blending, and as a result makes things less transparent. Is this 'wanted' behavior from renderers (by the color maintainers/part authors)?
Imho it makes sense to cut off culling for trans parts makes sense since IRL you may see the back side of trans parts!
Thanks for the info, I think I'm going to add a option to do something similar.

Only downside for me is I can only toggle culling on a per part usage level, out of mesh management/performance considerations.
Pages: 1 2