Electricity shaders

Aye. Macs is pretty pedantic with shaders.



Always make sure floating points have their 0.



Ie: 0.0, 1.0, 48464.0

That sort of thing.

Great work.



but as mentioned before, the first screen look like ICE, so why not create ice shader too? :slight_smile:

will it look like ice?(without motion)

Awesome work. Let us know if you run into any problems with the AssetPack creation. We’d love for more contributors to get into the habit of making Plugins and AssetPacks as a means to more effectively share their work with all jME3 users.

1 Like

Very nice, they both worked fine for me as well.

@cvlad: Hey, Uni Paderborn, I studied there, too. Are you in the Computergrafik I + II lectures held by Gitta Domik? :smiley:

@survivor

Not yet.

@erlend_sh said:
Awesome work. Let us know if you run into any problems with the AssetPack creation. We'd love for more contributors to get into the habit of making Plugins and AssetPacks as a means to more effectively share their work with all jME3 users.


Thanks for the offer. I will try it tomorrow.

@kwando I read that document. Personally, I don't think this shader could gain all that much from supporting it, since it's using a blended shell, which already could be used for a cheap glow. So there's no need to throw post processing at it, when you can get away with computationally inexpensive operations. Nonetheless, I will give it a shot tomorrow and let you know how it worked.

@oxplay2 Just by setting the electricity's speed to zero: No. But it's fairly close, you could try a slightly different ramp texture than mine plus tweaking the other values a bit. The assetpack will be available within this week. Probably tomorrow.

Here are the third and fourth shader which will be available in this assetpack:
http://homepages.uni-paderborn.de/cvlad/jme_electricity3/run-applet.html
http://homepages.uni-paderborn.de/cvlad/jme_electricity4/run-applet.html
And screenshots:
http://i.imgur.com/8HkgO.png
http://i.imgur.com/jFL5J.png
http://i.imgur.com/c0eYi.png
http://i.imgur.com/WNBaj.png
1 Like

We need some sort of wiki page that is a collection of all the awesomest shaders :slight_smile:

1 Like

How does the shell thing works? you have an extra object bigger than the original one on which you apply your shader or are the vertex offset in the vertex sahder?

It seems applets work under linux! Looks great!!! Will you commit your shaders to the ShaderBlow?

It seems you are that guy who needs JME community! :slight_smile:



Warm welcome from us!

@nehon said:
How does the shell thing works? you have an extra object bigger than the original one on which you apply your shader or are the vertex offset in the vertex sahder?


I bloat the mesh up by pushing the vertices into their normals' direction in the vertex shader, just like most toon outline shaders do, though obviously I'm turning faceculling off instead of using frontfaceculling.
[java]vec4 vertex = vec4(inPosition, 1) + vec4(inNormal * m_width, 0);
gl_Position = g_WorldViewProjectionMatrix * vertex;[/java]

Btw, as for the workaround of not having two materials on one geometry node, I simply grab the geometry nodes from one loaded and animated node and push their mesh references into new geometry nodes. Works like a charm.
[java] Spatial animal = assetManager.loadModel("Models/spider.j3o");
Material mat = assetManager.loadMaterial("Materials/electricity4.j3m");

for (Spatial child : ((Node)animal).getChildren()){
if (child instanceof Geometry){
Geometry electricity = new Geometry("electrified_" + child.getName());
electricity.setQueueBucket(Bucket.Transparent);
electricity.setMesh(((Geometry)child).getMesh());
electricity.setMaterial(mat);
((Node)animal).attachChild(electricity);
}
}[/java]
So I have only overhead for doing culling twice, the mesh and thus animation is shared. Well that and the overhead you would get from having two materials on one node, that is one more drawcall, and some overdraw.
This way the geometries can be in different queue buckets, which wouldn't be possible by using the composite pattern for materials like the grass/fur shader on this forum does.
2 Likes

Why not set the scale of the electricity geom to something like 1.1 to avoid the vertex calculation then?

Anyway, very nice work, this looks very promissing

@nehon said:
Why not set the scale of the electricity geom to something like 1.1 to avoid the vertex calculation then?
Anyway, very nice work, this looks very promissing


There is a difference between scaling and pushing verts along their normals.
1 Like

Yep. Moving verts along normals looks like this:

http://blogs.unity3d.com/wp-content/uploads/2010/07/SurfaceShaderNormalExtrusion.png

Which is different from this

http://blogs.unity3d.com/wp-content/uploads/2010/07/SurfaceShaderDiffuseBump.png

2 Likes

yeah but it can be placed properly to have the same effect…but yeah it can be different according to the origin of the mesh…

His way works in any case and is hardware accelerated so I guess that’s fine.



Edit : oh ok didn’t see your picture, yeah you inflate the model :stuck_out_tongue:

Very nice :slight_smile:



I guess the inflation process means you will end up with gaps if you use flat shaded models? (i.e. two vertices at same co-ordinates with different normals). That shouldn’t be a problem though, just something anyone using the shader needs to be aware of.

Exactly. Though flat shaded models are to be avoided anyway, since they increase the vertex amount.

One expensive but easy way around this problem would be to duplicate the model completely and smooth it’s normals and use that duplicate.

Another more efficient but harder way would be to push smooth normals into texcoords/vertex colors/whatever and use those for inflation. Either way it requires work on your side.

Got another one working.

http://homepages.uni-paderborn.de/cvlad/jme_electricity5/run-applet.html



Screenshots:

http://i.imgur.com/4WnGu.png

http://i.imgur.com/uq5W0.png



One more to go, then I will have run out of ideas and release this thing.

5 Likes

That’s really “kuhl”. The cow level is a lie! :smiley:

OMG!!! You are my electricity God! :slight_smile:

I defenetely want to use your shaders!