Plasma tube like effects

@EmpirePhoenix said:
dont set glowcolor, use a glowmap you generate similar texture procedualy via a shader (see wiki for how to use glow in custom materials).

That's not a bad idea unless you have lots of surfaces to texture. That would double the workload. But yes, I agree it would work nicely when you don't have that many to do.

Well yes it would cpu wise, but since you usually only have like 1-2 suns at the same time this is probably not really eating that much performance away. (Also for the glowmap you could just use the rough version without all the more detailed noise levels)

The above runs on the GPU, not on the CPU.



As for performance issues, I’ll test it out when I’ll get back to that. Gotta beat other things first.

As Madjack says, these are procedural textures (well really its a 4d volume not a texture in the classical sense) generated in the GPU.



Question - could I just use a glowmap based on this procedural texture and not have a texture at all? What would the results of that look like?

A glowmap has to be used as a post process…



The good thing is, every time a 4d texture is generated, it’s the same. Always. Unless you change parameters of course. The other thing is, it’s 3D and animated. Now, you could do without the animation I guess, but it wouldn’t look as good.



The only way I could see using this as a glowmap is if you were doing this CPU-side, fetch the texture in memory, apply a deformation to accommodate the shape it’ll be on, save it to a texture then pass it on to the shader as a glowmap.

I’m not sure I understand why replacing the object’s glow shader with your own that rendered a glow version of your procedural texture wouldn’t work. It’s glow.frag that renders the glow map for the object. You already have your own material so I’d think you could just swap the glow technique out with your own shaders.

@pspeed said:
I'm not sure I understand why replacing the object's glow shader with your own that rendered a glow version of your procedural texture wouldn't work. It's glow.frag that renders the glow map for the object. You already have your own material so I'd think you could just swap the glow technique out with your own shaders.

What?

I'm not saying to replace the shader. The glowmap is a texture. There's no texture to use in a procedural texture so the above would be a way to get a similar texture to use as a glowmap... Although if the generated texture is animated it might not look that good since the shades of the color would come and go but not the glowmap.

As far as using the glow pass in the texture generation shader it could work by using the passed color, but again, no glowmap (or colormap or whatever it's called). It comes back to the same.
@madjack said:
What?

I'm not saying to replace the shader. The glowmap is a texture. There's no texture to use in a procedural texture so the above would be a way to get a similar texture to use as a glowmap... Although if the generated texture is animated it might not look that good since the shades of the color would come and go but not the glowmap.

As far as using the glow pass in the texture generation shader it could work by using the passed color, but again, no glowmap (or colormap or whatever it's called). It comes back to the same.


I guess I misunderstood the thread by skimming.

I thought that there was a generated texture for the coloring and that one would want a similar generated "texture" for the "glow map".

Since the "GlowMap" texture2D object is just an artifact of the simple glow.frag, I couldn't see why you'd even want it. It will be pretty easy to render a "glow map" on the fly just like the regular shape was rendered in the normal pass. Then you'd have perfect synergy between glow map and diffuse texture. In fact, given the way the plasma looks you could probably just use the same .vert and .frag for the Technique Glow in the j3md and it would look fine. Or at least be a start for tweaking.

But I guess the thread is about something else. Sorry for the noise.

I think I need to look at how the glow technique works some more before I can comment but yes, that’s essentially what I was thinking might work. You do end up generating the texture twice though and I’m not sure how expensive that would be.



This is back on the back burner for now anyway but it should be fun to play with when I get to it.

@madjack said:

The .vert
[java]
/*
* 4D animated noise texture GLSL vert shader.
*/
uniform float g_Time;

uniform mat4 g_WorldViewProjectionMatrix;
uniform mat4 g_WorldViewMatrix;
uniform mat4 g_ProjectionMatrix;

in vec4 inPosition;
in float m_Radius;

out vec4 texCoord4D;

void main( void )
{
gl_Position = g_ProjectionMatrix * g_WorldViewMatrix * inPosition;
texCoord4D = inPosition / (16 + m_Radius);
}
[/java]



Quick question - why use gl_Position = g_ProjectionMatrix * g_WorldViewMatrix * inPosition rather than gl_Position = g_WorldViewProjectionMatrix * inPosition ?

Surely the second one uses one fewer matrix multiplication and gives the same result?

Rendering the procedually map similar to the glowmap in the default glow was what I suggested from the beginning. And with cpu wise I meant, gpu power currently increase rapidly, while cpu (son one core alone) stays kind the same. As long as your additional work is on the gpu it’s not that bad then.(Like generating the glow map more or less twice one time for the glow and one time for diffuse.)

Doing it any other way, anyway all the ways I tested, rendered a texture with distortion around the equator in the case of my stars. If you’re only doing simple things like quads it should work with g_WorldViewMatrix * inPosition; Except for that, test different combinations.

Isn’t their a way to make a reapting pattern of the look your trying to achieve and just apply it to a model of the shape you want it in the 3d space?