I'm exporting a little particle waterfall splash from 3ds max as a sequence of OBJs. Each OBJ has several triangles with different values for visibility. I have two problems: the first, naturally, is to export these values per-polygon (a simple MaxScript should produce a companion text file describing their visibilty), and the second, of course, is to apply these visibilities per-polygon in jpct (lest I have to have an Object3D per polygon, which seems bizarre memory-wasteful). Is this possible?
I would expect the exporter to export polygons with different transparency as individual objects. They have to be separate objects to be rendered, because transparency and blending modes are render states just like a shader assignment. You can't render polygons with individual transparency in one batch (at least not unless you write a special shader and assign additional vertex attributes).
So if the splash consists of 200 triangles I have to have 200 Object3Ds per frame?
Yes. You might be able to group/merge them by transparency, but that's basically how it works. As mentioned, you could create a shader driven particle system that does everything in the vertex shader, but i don't think that this is needed. Personally, i never did that. I always used separate objects for the sake of simplicity.
OK, thanks. I don't suppose you have any experience with MaxScript, do you?
No, not even a tiny little bit.
OK, thanks. But a follow-up: how do I even set opacity of these particles? How do I make an Object3D 30% opaque?
The values that you set in Object3D.setTransparency(<int>) will be mapped to 0..1. 0 is fully transparent, 1 is opaque. How this mapping happens this based on a formular described here: http://www.jpct.net/doc/com/threed/jpct/Config.html#glTransparencyMul (http://www.jpct.net/doc/com/threed/jpct/Config.html#glTransparencyMul) and here: http://www.jpct.net/doc/com/threed/jpct/Config.html#glTransparencyOffset (http://www.jpct.net/doc/com/threed/jpct/Config.html#glTransparencyOffset). The default setting tries to mimic the software renderer. If you are on hardware only, i suggest to adjust the values so that the actual formular gives you finer graduated values.
I don't even sort of understand that answer. In code, how would you make an Object3D 30% opaque using the OpenGL renderer?
You use setTransparency on that object. If it really has to be exactly 30%, you have to make sure that the mentioned formular gives you 0.3. To dont this, you might have to tweak the config settings that i mentioned. Like setting the offset to 0, the mul to 0.01 and setTransparency to 30.
OK, thanks. I got it now, but does that not sound bizarrely intricate to you for something so relevant? Do you not feel the need for a setAbsoluteTransparency(float between 0f and 1f) or so?
Quote from: AGP on February 09, 2014, 07:16:50 AM
Do you not feel the need for a setAbsoluteTransparency(float between 0f and 1f) or so?
Actually no. I see your point and if i would do it again, i would most likely do it that way...if there weren't the software renderer. The current solution is the way it is because of the software renderer. I agree that it's harder to grasp than [0..1], but on the other hand nobody ever complained about it until now... ;)
Nobody ever complained to you, anyway. :- )
Why would you do it the same way if there were no software renderer?
Quote from: AGP on February 09, 2014, 09:12:31 PM
Why would you do it the same way if there were no software renderer?
I wouldn't. That's what i was trying to say... ;)
Oh, I see. I think I'd rather have the software renderer, though. :- )
The texture for these planes are PNGs with an alpha channel (see below). Why, then, are the planes appearing rectangular?
https://dl.dropboxusercontent.com/u/93826015/splash.png
(https://dl.dropboxusercontent.com/u/93826015/TextureAlpha.jpg)
Most likely because you are loading them wrong. You have to use the one of the constructors in Texture that take a boolean for useAlpha and set it to true.
Thanks very much, you were right.
Did you see the other guy (in so many days) "complain" about the same thing I did? : -)
Quote from: AGP on February 10, 2014, 09:22:49 PM
Did you see the other guy (in so many days) "complain" about the same thing I did? : -)
Which is... ???
That setTransparency(int) is counter-intuitive. We just covered the subject.
Quote from: AGP on February 10, 2014, 09:41:55 PM
That setTransparency(int) is counter-intuitive. We just covered the subject.
No, that's not the point of the other thread. He wants to create some stencil effect by using blending. That's something different.