FIXED: 2020.27390 :: Default PointSpriteMAT doesn't respect "active" instancing attribute

Seems like ye’ old pointsprite MAT doesn’t obey the instancing “active” attribute like Phong, PBR and Line MATs do. Alternatively, as a side RFE, could we just give Line MAT a user specified sprite TOP for the circle sprite mode point render option?

Thanks
P

We’ll note both, but honestly your Point Sprite MAT approach will be 10x faster than Line MAT, Line MAT very heavy.

Heya

Coming back around to this, I’m making a super simple custom point sprite material with GLSL MAT and trying to lean on the active instance par again. In this case i see all my “inactive” instances stuck to the center of my camera. Makes me wonder, does the active instance channel actually prevent the rendering of the instance or is it just a transform trick that isn’t working when gl_PointSize is invoked in the shader? For now I can use my active channel ( i’m using TOPs for the instancing data) to multiply point size down to nothing but curious if there is still a bug here.

Cheers
P

Yeah, I can see this as well with Point Sprite MAT as you initially reported. Looking into it now.

This is now fixed in the Point Sprite MAT.

Instance Active is indeed a transform trick. There is no way to ‘delete’ a vertex, so instead, when TDInstanceActive() == false, then somehow gl_Position needs to be set to vec4(0). This throws the vertex offscreen. The TD* transform functions will return either mat4(0), or vec4(0).
If you are doing totally custom transforms then you’ll need to do this manually.

Actually it seems like setting gl_Position = vec4(0.0) doesn’t do the trick with Point Sprites. It should, since the divide by W=0 should throw it to infinity. Some GPU intricacy I guess.
You need to manually send it beyond the far plane instead, vec4(0, 0, 2, 0);

I’ve further tweaked the TDWorldToProj() to return vec4(2,2,2,0) when the instance isn’t active, to throw the vertex outside the NDC clip planes. For cases where w == 0 doesn’t the trick itself.

Fixed in builds 2021.10620 and later.