Shader Talk - Conversations on GLSL

It comes from somewhere in my head who doesn’t understand too much shaders :smiley:

So I delete the line and do a PR.

2 Likes

One thing that is a default uniform in ThreeJS but apparently not Babylon is the camera position (cameraPosition as it’s named), which is important in computing lighting. Is that something that we should be implementing as a uniform ourselves or is it there under a different name?

This is not available but it is easy to do :slight_smile:

Is there an example? Do you just send it in as scene.activeCamera.position?

I will add a cameraPosition default value for the next nightly :slight_smile:

2 Likes

can you add the camera target too :slight_smile:
specially with fov

vec4 (target.x,target.y,target.z ,fov ) :))))

1 Like

That will be cool, I can’t even count the number of times I’ve had to script that into a shader.

1 Like

Who knew all I had to do was ask???

:wink:

1 Like

This is why we are all here :smiley: To ask or to answer

1 Like

turn the iterations down to 1, to make it more simple.

Now what was the question?

F is just a float that is being calculated from the distance of the screen to a point which is being offset by the sin and cos function.

That is then ramped by dividing it into 0.001

and then the whole process is offset and looped.

at the end you have a f value for every pixel that you then use to scale a color.

1 Like

nice loading
http://glslsandbox.com/e#61399.1
http://glslsandbox.com/e#61399.0

2 Likes

Fun that could be a whole sub thread. Glsl loading spinners.

2 Likes

First time I saw this is real life, I totally hopped on the shader editor and made a version as well, thats funny!

This has been really cool watching you develop your shader skills.

2 Likes

How to “step-debug” shaders is a Double-LIKE.

Saved the link above by @Necips thank you.

This thread is favorite. Someday I will get to play more, sorry.

Still on the steps before all these cool things…

But will return to the glsl-transpiler link above 1st.

~ : ) -.

1 Like

Circle particles + Simplex noise = Roundworms :bug:

dark version: Babylon.js Playground
lighter version: https://www.babylonjs-playground.com/#J2C62M#2

6 Likes

thats super fun

Can you rephrase that? Are you looking to make a Pseudo-Volumetric 2D texture, using like a slideshow method sampling method?

I guess you are talking about raymarching through screenspace rays?

http://glslsandbox.com/e#61957.0

Just to much going on, you had it “right”

How do we do that same thing in BJS I am wondering?

I have this setup:
https://playground.babylonjs.com/#UXRQKD#6

Now I just need to pass it the backbuffer.

@Deltakosh, maybe you know a quick and easy way to pass the prior state of the texture back to itself? I tried doing readPixels but ew no… Maybe pass it to a rtt and have that be passed back to the texture so that way I can force its update?

https://www.babylonjs-playground.com/#I30SDL#37 <- this is literally the only time I’ve gotten a ping-pong simulation to work and it was a pain in the *&^%. There has to be a better way. If not then I need to come up with a method that makes this easier.

What am I doing differently here: Babylon.js Playground
That I am not doing in the prior working example?

Maybe its just a timing issue? I have the backframe being generated here if you look in the inspector.
https://playground.babylonjs.com/#UXRQKD#9

But the second I bind it back to the prior texture I get errors:
https://playground.babylonjs.com/#UXRQKD#10

I think I have to force them to update or something.

@Necips
Here is a better example for the question you had though:
http://glslsandbox.com/e#61957.1