[Help] How to create normals of a height map within the vertex shader

Hello there, I’ve got a vertex shader which generates a height map but I need to calculate the correct normals, don’t have a clue where to begin with it anyone able to walk me through it?

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/iiRemiix
πŸ“…︎ Jan 04 2022
🚨︎ report
Potentially basic shader question: Why am I getting stepped alpha values in fragment(), but a smooth vertex displacement along the x-axis in vertex()?
πŸ‘︎ 19
πŸ’¬︎
πŸ‘€︎ u/picklepartner99
πŸ“…︎ Dec 21 2021
🚨︎ report
Captains log 3 jan 2022: Learning shaders (GLSL): Changing shapes with own vertex shader now while maintaining effects of lighting, bumps, normals etc. v.redd.it/c17acuh48i981
πŸ‘︎ 72
πŸ’¬︎
πŸ‘€︎ u/Maarten77
πŸ“…︎ Jan 03 2022
🚨︎ report
Vertex Offset in Shader Graph?

Hello, I was trying to follow a tutorial for making a foliage shader. I was recreating the shader in Shader Graph instead of amplify and rn I'm stuck because I dont know how to make a vertex offset. I'll post the pic of mine and what I was following, can anyone tell me what I am missing? Edit: one kind man helped me with the offset but probably there is a problem with how I did the graph.

My Graph

Amplify

what I want

πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/Arcy_
πŸ“…︎ Jan 07 2022
🚨︎ report
Creamy swirls vertex displacement and tessellation shader for my Gravity Gun! v.redd.it/tmrlgf3bnzw71
πŸ‘︎ 861
πŸ’¬︎
πŸ‘€︎ u/MirzaBeig
πŸ“…︎ Nov 01 2021
🚨︎ report
Captains log 3 jan 2022: Changing shapes with own vertex shader now while maintaining effects of lighting, bumps, normals etc. v.redd.it/lmk6cnil7i981
πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/Maarten77
πŸ“…︎ Jan 03 2022
🚨︎ report
Made a little tutorial on animating with vertex colour and shader graph. Hope it helps someone! youtu.be/X2IbtsnPtYs
πŸ‘︎ 30
πŸ’¬︎
πŸ‘€︎ u/AerodynamicLlama
πŸ“…︎ Dec 01 2021
🚨︎ report
To get around the Vita's slow processing of pixel lit alpha images, I wrote a lightmapped, vertex lit cutout shader, added a vertex copy of the main pixel flashlight, and set up layers so that the lights only affect what they need to- vertex for foliage, pixel for everything else. Much better FPS youtu.be/plh_cfwF620
πŸ‘︎ 53
πŸ’¬︎
πŸ‘€︎ u/noradninja
πŸ“…︎ Nov 07 2021
🚨︎ report
i used a vertex shader to make a heat map of random particles passing through a plane v.redd.it/rnhkk9ybkvq71
πŸ‘︎ 164
πŸ’¬︎
πŸ‘€︎ u/76buccaneers
πŸ“…︎ Oct 01 2021
🚨︎ report
Shader Painter : | Forum thread |Shader Painter is a painting tool which allows you to paint advanced shader effects. More than a simple vertex tool, with this extension you will be able to paint directly on pixels. This way, you can paint extremely complex details on a simple polygon.Shader Paint assetstore.unity.com/pack…
πŸ‘︎ 3
πŸ’¬︎
πŸ“…︎ Dec 17 2021
🚨︎ report
Experimenting with how to use world position with vertex displacement in Shader Graph :D v.redd.it/5i5onhlghz181
πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/fairchild_670
πŸ“…︎ Nov 26 2021
🚨︎ report
All values that are received by fragment shader has to be passed by the vertex shader?

I'm learning from https://learnopengl.com/Getting-started/Textures and am currently on texture chapter. I can't seem to understand why we're passing texture coordinates to vertex shader and then from there to fragment shader?

Can't the fragment shader directly read my texture coordinates like the following:

layout (location = 2) in vec2 textcoord;

Or can I use uniforms to bypass this shit?

EDIT: Here's the code for both of them:

#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 2) in vec2 atextcoord;
out vec2 textcoord;
void main()
{
    gl_Position = vec4(aPos, 1.0);
    textcoord = atextcoord;
}


#version 330 core
in vec2 textcoord;
out vec4 FragColor;
uniform sampler2D ourTexture;
void main()
{
    FragColor = texture(ourTexture, textcoord);
}

EDIT: Thank you everyone for your response. Now I finally understand this pipeline shit. The texture coordinates received by the fragment shader is for each pixel and way more than just a few that I've passed to the program and hence makes no sense to read it directly.

I have got another question then: is it possible to print the values received by the shaders? Or atleast pass it to my program so that I can atleast error check them?

πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/lundfakeer69
πŸ“…︎ Oct 28 2021
🚨︎ report
Made a little tutorial on animating with vertex colour and Unity's shader graph. Hope it helps someone! youtu.be/X2IbtsnPtYs
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/AerodynamicLlama
πŸ“…︎ Dec 02 2021
🚨︎ report
A little tutorial on how to fake shadowcasting with vertex lights- great for performance, especially with mobile GPU’s. If the Vita can do it, anything modern can. Shadow shader is linked in video description. youtu.be/fbqY1TgokGU
πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/noradninja
πŸ“…︎ Nov 24 2021
🚨︎ report
Is there a specific technical limitation on why Vertex Shader and Fragment shader are not totally separated ?

Hi,

Am not sure if i am missing a fundamental concept but it honestly never made sense to me to treat the Vertex Shader as a "Material", let alone combine it with the Fragement Shader in the same program.

Cause at the end of the day one is modifying pixels, and the other vertices, why are they merged together ?

Imagine a scenario where you need a vertex shader to achieve snow trail for example, wouldn't it be better if you could just write a shader that modify a vertex position based on whatever rule you set (texture, or world space vector) and that's it, now you have the base "leave a mark" effect.

And then you can create a separate fragment shader and you can have one for snow, one for sand, one for goo, one water, etc... and all that this Shader care about is basically the final color (light, shadow, smoothness, opacity, etc... at the end of the day they are all colors) without having it over-bloated with settings from the vertex shader or settings to "consider" alternative scenarios (one shader for Snow and Sand and Mud)

And for a more practical example, which I just encountered, I wanted to use the "Boing Kit" which some of it is CPU based (just attach a component) but other features are vertex-shader, well, now if you're game uses a custom shader to look original, you'd have to find a way to include the Boing Kit vertex shader into your already made custom shader, now the boing kit make it easy to do that , but this seems a bit weird to me tbh, and a waste of time on something that shouldn be done in a better way.

 

So can a Shader expert clarify why is this happening ? after all in all Shader languages and Editors, there is a clear distinguish between the Fragement program and the Vertex Program, so why don't game engine and even 3D softwares like Blender, create a higher level separation so that you can create a Material to modify color and light reaction (fragment), and a Material to modify the shape (vertex), and if the GPU must run them both as a single program to reduce drawcalls per object or something, then just merge them before compiling, is there a particular technica reason why this isn't a thing (yet) ?

 

Thank you

πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/alaslipknot
πŸ“…︎ Sep 19 2021
🚨︎ report
Playing around with Blender 3D geometry nodes and shader nodes. All geometry, lighting and shaders generated from a single 4 vertex plane.
πŸ‘︎ 29
πŸ’¬︎
πŸ‘€︎ u/MrUPGrade
πŸ“…︎ Nov 02 2021
🚨︎ report
To get around the Vita's slow processing of pixel lit alpha images, I wrote a lightmapped, vertex lit cutout shader, added a vertex copy of the main pixel flashlight, and set up layers so that the lights only affect what they need to- vertex for foliage, pixel for everything else. Much better FPS. youtu.be/plh_cfwF620
πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/noradninja
πŸ“…︎ Nov 08 2021
🚨︎ report
Just made freely available: PSX Shader Kit for Unity. Shaders for achieving a PS1 aesthetic. Emulated PSX rendering features: -Dithering -Color Banding -Low-precision vertex snapping -Affine perspective-uncorrected texture mapping -Triangle sorted rendering. Affiliate link / ad assetstore.unity.com/pack…
πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/221B_Asset_Street
πŸ“…︎ Oct 06 2021
🚨︎ report
Recently I fell in love with PS1 style graphics so here is my imitation shader to recreate it! Vertex snapping & tiny texture distortion in effect!
πŸ‘︎ 445
πŸ’¬︎
πŸ‘€︎ u/lenLukas
πŸ“…︎ Jun 09 2021
🚨︎ report
Incremental change of shader property from within vertex func

my issue is simple

void vertexDataFunc(Β inout appdata_fullΒ v,Β out InputΒ oΒ )
{

_PropertyΒ =Β 1; works

_PropertyΒ +=Β 0.1; doesnt

}

second example either immediately maxes the value (no, changing it to 0.00000001 wont help) or just does single iteration as if it wasnt saving the value.

why is that?

πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/DaySolo
πŸ“…︎ Sep 29 2021
🚨︎ report
Stylized Grass Shader : Documentation | ForumKey featuresβ€’ Lush wind animationsβ€’ Per object and per vertex color variation, breaks up visual repetitionβ€’ Easy to use interaction system. Bending and flattening through trails, meshes, lines or particle effectsβ€’ Sun light translucency renderingβ€’ Colo assetstore.unity.com/pack…
πŸ‘︎ 3
πŸ’¬︎
πŸ“…︎ Oct 06 2021
🚨︎ report
Shader language Vertex accessing

I am trying to write a shader where i want to access other vertices but I could not figure out how to do it and could not find a answer after googling.

Something like:

void vertex()
{
    vec3 otherVertext = VERTEX.getAdjecent(1,1);
}
πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/HoLeYeet
πŸ“…︎ Aug 31 2021
🚨︎ report
Communication between vertex and fragment shaders when dealing with shadows.

I'm trying to make my own 3d engine with love2d. Everything has been going really well until i wanted to implement shadows into my engine. I have no idea where to even begin. Can someone please help me with this?

πŸ‘︎ 5
πŸ’¬︎
πŸ“…︎ Sep 11 2021
🚨︎ report
Tips for reducing vertex count - Unity Compute Shaders

My project is going dandy, but I'm now trying to optimize it, so that I can get some good FPS. I'm using compute shaders for marching cubes (alongside the new mesh API to pass the triangles indirectly) alongside an octree implementation to get good FPS, but I'm noticing that my program seems to be GPU bound, as when generating worlds with size of about 8000x8000x8000 on somewhat low level of detail, I get more than 4m+ vertices.

My implementation of marching cubes does not have vertex sharing, so I'm wondering if that's possible with compute shaders? Also, if anyone has more tips, that would greatly appreciated! I can give more info too.

πŸ‘︎ 7
πŸ’¬︎
πŸ“…︎ Jul 13 2021
🚨︎ report
Fun with vertex animation texture shaders with Unity3d and Houdini (liquid, cloth and rigid). All animation in the shaders. v.redd.it/1da0vn6tat971
πŸ‘︎ 32
πŸ’¬︎
πŸ‘€︎ u/barkarIvan
πŸ“…︎ Jul 07 2021
🚨︎ report
Particle system Custom Vertex Stream overwrites my vertex displacement shader

Basically the title. Is there a way to remove the position stream or do something about it?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/yellowpaint0
πŸ“…︎ Sep 06 2021
🚨︎ report
My Custom Shader Material now supports (almost) all standard material types and all standard material properties including shadows and vertex colors! It also supports custom diffuse color via Fragment Shader along with custom Vertex Shaders with standard materials as a base. Find it in the comments! v.redd.it/34c71yrjyib71
πŸ‘︎ 40
πŸ’¬︎
πŸ‘€︎ u/ppictures
πŸ“…︎ Jul 16 2021
🚨︎ report
Simple shader question about VERTEX in 2D

This is a very silly question, but I can't figure out.

Why this don't work?

shader_type canvas_item;
uniform float force = 10.0;


void vertex(){
    VERTEX.x += sin(TIME)*force * VERTEX.y;
}

As far as I "know", if VERTEX has those positions (that they seem to have when I ""debug"" them with COLOR):

https://preview.redd.it/80nc6it34eb71.png?width=288&format=png&auto=webp&s=ca439551eaaa4138e8d7248cf89d571815835fff

The VERTEX will only be displaced on the bottom vertices (since VERTEX.y is (?) 0 and it makes 0 the displacement).

But the ressult is all vertices osciling like:

https://preview.redd.it/k0o1h3s36eb71.png?width=458&format=png&auto=webp&s=b92248ccb7aa1162e9cc2dd4deae1654083b59bb

Please, can someone give me an explanation why this is happening and dont work as I said?

(BTW, I know I could solve the problem with UV, I'm just trying to fully understand (I don't care about the effect))

πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/LauraGL3
πŸ“…︎ Jul 15 2021
🚨︎ report
Vertex Thickness Generator : Editor and runtime solution for generating mesh vertex thickness (inspired by GDC 2011 Colin Barre-Brisebois talk), that can be used in various calculations and effects, including Translucent and Subsurface Scattering shaders.Editor tool automatically bakes generated r assetstore.unity.com/pack…
πŸ‘︎ 4
πŸ’¬︎
πŸ“…︎ Sep 07 2021
🚨︎ report
Create a basic Vertex Shader

Hey there. I am having issues rendering my Vertex Shader. I want it to have the same behaviour as if it was passed with no effect and add my own logic on top of it. I tried to use the default .fx file that is provided with the content pipeline but it just shows nothing, even after setting the mvp field. I think it should help if I knew how to get the position passed in spriteBatch.Draw() in my shader, but I'm probably just missing something. Can you help despite my newbie question ? Thanks !

πŸ‘︎ 9
πŸ’¬︎
πŸ‘€︎ u/Dathussssss
πŸ“…︎ Jul 21 2021
🚨︎ report
Hey guysss! Recently I fell in love with PS1 style graphics so here is my imitation shader to recreate it! Vertex snapping & tiny texture distortion incomming...
πŸ‘︎ 53
πŸ’¬︎
πŸ‘€︎ u/lenLukas
πŸ“…︎ Jun 09 2021
🚨︎ report
Some stress testing of my vertex based PBR shader for the PS Vita, for my upcoming survival horror game. imgur.com/a/emfxrMp/
πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/noradninja
πŸ“…︎ Jul 26 2021
🚨︎ report
Level of detail passed from vertex shader to fragment shader

I am looking at a sample code from a respected source and the mipmap level-of-detail parameter (float) is passed to the vertex shader as a uniform which then passes to the fragment shader without using the flat keyword, thus subject to interpolation(but all the vertex shaders are providing the same value-what would be the point of interpolation). What could I be missing here?

Is it not better to pass a such a variable as a uniform to the fragment shader?

πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/Tensorizer
πŸ“…︎ Jul 23 2021
🚨︎ report
How do I convert a vertex WordPosition to UV position inside a shader?

Greetings

How do I convert a vertex WordPosition to UVPosition inside a shader ????

v2f vert (appdata v)
{ 
   v2f o;

   o.worldPos = mul (unity_ObjectToWorld, v.vertex);
   o.vertex = UnityObjectToClipPos(v.vertex);
   o.uv = TRANSFORM_TEX(v.uv, _MainTex);

   return o;
}

fixed4 frag (v2f i) : SV_Target
{ 
  // sample the texture 
  fixed4 col = tex2D(_MainTex, i.uv);
     
  float2 uvPos = ???????????????

  return col;
}

Thank you.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/cipriantk
πŸ“…︎ Sep 09 2021
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.