Jump to content

[SOLVED] - BABYLON.TerrainMaterial Shader BUMP Support


MackeyK24
 Share

Recommended Posts

While trying to add additional support for my new SplatmapMaterial... I am using TerrainMaterial shader as a base/guide to make my modifies splatmap material...

 have a question regarding bump map... if you look in the code normal is calculated ... BUT I CANT SEE WHERE IT IS ACTUALLY BEING USED ... Please look at this:

	// Bump
#ifdef NORMAL
	vec3 normalW = normalize(vNormalW);
#else
	vec3 normalW = vec3(1.0, 1.0, 1.0);
#endif

#ifdef DIFFUSE
	baseColor = texture2D(textureSampler, vTextureUV);

#if defined(BUMP) && defined(DIFFUSE)
	normalW = perturbNormal(viewDirectionW, baseColor.rgb);
#endif

now that calculates out normalW ... but after that NOWHERE is normalW being used... HOW IS BUMPING BE APPLIED ???

Attach is who vertex and fragment programs... Please tell me whats up with the BUMP feature from BABYLON.TerrainMaterial

terrain.vertex.fx

terrain.fragment.fx

@Deltakosh , @Sebavan , @davrous or @RaananW Please Help If Can :)

 

Link to comment
Share on other sites

11 hours ago, Deltakosh said:

Thanks Delta... I eventually figured that out... I now use a modified PBRMaterial for my SplatmapMaterial... That way i can pick ALL the regular PBR material lighting...

It was actually easier than before... 

i just replace the: albedoColor = texture2d(albedoSampler) with the blended up splatmap textures... EASY PEASY... same thing for bumping... that way we DONT change anything from the par shaders EXCEPT of course adding the additional texture properties and blending up all those texture colors RIGHT where you would normally use texture2D(albedoSampler) and texture2D(bumpSampler)... So easy... and works beautiful, so far :)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...