Maybe I got confused by their family names, but I was expecting Sprite SOPs to support Point Sprite MATs.
If I use Particle SOPs to handle Point Sprites MATs, then I have all those extra attributes associated with particles that would be unnecessary and heavy for my needs.
I was thinking on a straight forward way of stamping Point Sprites in a scene, something like the Limit SOP, the Channel SOP, or well, Sprite SOP, but doesn’t seem to work.
The Sprite SOP is a CPU based approach to sprites, it creates geometry in SOPs.
The Point Sprite MAT creates sprites on the GPU.
So no they don’t work together. Sorry we don’t have much documentation on these features yet.
OK, so those are parallel worlds, but then is there any way to control Point Sprites with vertex shaders?
Or let’s say that I generate position channels out of r g b values from a GLSL TOP, would I be able to grow some Point Sprites from there?
To be more specific, I was thinking on a GPU model for audio synthesis. By generating a texture with a sine wave, translated into a grey scale horizontal ramp, and using a camera where distance would be affecting frequency and amplitude (if some fog is applied). Things like that.
A point sprite with a sine wave sounds even better. I’ve just read also about this uniform sampler1D sCosineLookup, but didn’t try it (there are no ways to generate a sampler1D with touch, right?).
Should I just map polygons and digest all it’s extra vertices?
I wanted to evaluate the different possible models before diving into this task.
Sure, you can do that no problem. You still need to use the Particle SOP to create point sprite primitives. But from there you can use a vertex shader to do whatever to them. The key output of the vertex shader with point sprites is gl_PointSize. This is how you control the size of the sprites created. The size is the # of pixels high and wide the point sprite is. If you want your sprites to shrink as they go off into the distance you need to reduce this value yourself in the vertex shader. Make sure you write something to this value.
Seems doable to me. You don’t need to use a sampler1D if you are creating your own lookup table. You can just use a top with a height of 1, and sample the texture like this texture2D(sTexture, vec2(lookupValue, 0.5)); There really isn’t any difference between a 1D sampler and a 2D sampler with a height of 1, except for it’s slightly simpler to sample.
On Monday I can post a .toe file that contains all the code the current Point Sprite MAT does if you want.
Great! with this info I can switch to ‘say no more’ action mode till Monday, and yes, a .toe with some code sounds sublime.
tnXs
Here’s a GLSL MAT that matches all the features the Point Sprite MAT currently has.
pointspriteGLSL.toe (3.14 KB)
Awesome! This has been handy on several occasions.
I was hoping to find a GLSL shader that puts sprites on points rather than particles. Is there a way to edit this code or has anyone come across another shader that does this?
I have a piece of code that deforms point positions using tops but it utilizes a point number attribute in the code. I’ve had trouble merging the shaders because I can’t figure out a way to assign a unique value (or access a pre=existing one) to each individual particle. Is this possible?
Thanks!
-Matt
Years later, similar request.
What’s current (GLSL 4.3 or similar) version of gl_PointSize ? I have my own GLSL Mat that I want to use particles sprites. However, when I modify gl_PointSize in the vertex shader I can’t get it to affect the look of my particles.
I’d love it if the Phong GLSL node generated boiler plate code for the Particle Sprite MAT.
While we’re at it - what can I write in the vertex shader to modify the look when I set the particle render type to ‘render as lines’?
gl_PointSize is still used in newer GLSL. You need to ensure you are rendering Point Sprites for your particle type. A vertex shader can’t really be used to modify the look of primitive, it’s more for just moving them. A geometry shader is what you want to do that.