Mantis - Croquet
Viewing Issue Advanced Details
847 Jasmine minor always 01-26-05 01:25 01-26-05 20:33
elenzil  
 
normal  
new  
open  
none    
none  
0000847: TTorus: alpha < 1 disables rendering
I'll look into this.
Spheres and Cubes are fine.

TeaTest new openInWorld.
TParticle allInstances last removeSelf.
space _ TSpace allInstances last.
d _ TTorus new.
d material: TMaterial new.
space addChild: d.
d segments: 30.
d radius: 3.
d innerRadius: 1.
d material diffuseColor: #(1 1 1 0.5) asFloatArray.

s _ TSphere new.
space addChild: s.
s material: d material.

c _ TCube new.
space addChild: c.
c material: d material.
 TPrimitive hasAlpha and renderAlpha.1.cs [^] (1,091 bytes) 01-26-05 20:33

Notes
(0001103)
elenzil   
01-26-05 01:44   
.. well i've looked into it and have no clue.
it seems to be getting to the renderPrimitive routine when appropriate.
(0001104)
elenzil   
01-26-05 01:52   
sometimes i see the same thing rather unpredictably with other primitives.
(0001105)
Bob Arning   
01-26-05 16:11   
The reason for this behavior is a difference in the implementations of #hasAlpha and #opaque. An object is rendered in the first render pass if it is #opaque, for which a direct check of its material is made. An object is rendered in the second pass if it responds true to #hasAlpha. This tests not the material directly, but materialAlpha, which is set if the material has an alpha < 1 WHEN IT IS ADDED TO THE FRAME. So, you can see what you expect to see if you rearrange your code as:

TeaTest new openInWorld.
TParticle allInstances last removeSelf.
space _ TSpace allInstances last.
d _ TTorus new.
m _ TMaterial new.
space addChild: d.
d segments: 30.
d radius: 3.
d innerRadius: 1.
m diffuseColor: #(1 1 1 0.5) asFloatArray.
d material: m.

It would also be useful to get #opaque and #hasAlpha into a consistent state.
(0001106)
elenzil   
01-26-05 20:32   
i see..

is it possible that materialAlpha was first introduced with the notion of 'alpha' meaning 'original', and then later misinterpreted as meaning 'transparent' ?

I'm uploading a change set which modifies TPrimitive #hasAlpha and #renderAlpha to use simply material instead of materialAlpha. This change makes my original example code work fine. There are undoubtedly other places such a change should be made. (Possibly materialAlpha should be eliminated entirely ?)

Thanks for clarifying this.