Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:40:34+00:00 2026-06-13T17:40:34+00:00

I am trying to do normal mapping on flat surface but I can’t get

  • 0

I am trying to do normal mapping on flat surface but I can’t get any noticeable result 🙁

My shader

http://pastebin.com/raEvBY92

For my eye, shader looks fine, but it doesn’t render desired result( https://dl.dropbox.com/u/47585151/sss/final.png).
All values are passed.Normals,tengents and binormals are computed correctly when I create the grid,I have checked that!
Here are screens of ambient,diffuse,specular and bump map.

https://dl.dropbox.com/u/47585151/sss/ambient.png

https://dl.dropbox.com/u/47585151/sss/bumpMap.png

https://dl.dropbox.com/u/47585151/sss/diffuse.png

https://dl.dropbox.com/u/47585151/sss/specular.png
They seems to be legit…
The bump map,which is the result of (bump=normalize(mul(bump, input.WorldToTangentSpace)) definitely looks correct,but doesn’t have any impact on end result.
Maybe I don’t understand the different spaces idea or I changed the order of matrix multiplication.By world matrix I understand the position and orientation of the grid,which never changes and it is identity matrix.Only view matrix changes and represents camera position and orientation in own space.

Where is my mistake?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:40:35+00:00Added an answer on June 13, 2026 at 5:40 pm

    First of all, if you’re having a problem, it’s a good ideo to comment everything out, which doesn’t belong to this. The whole lightcomputation with ambient, specular or even the diffusetexture isn’t interesting at this moment. With

    output.color=float4(diffuse ,1);
    

    You can focus on your problem and see clearly what change, if you change something in you code.

    If your quad lies in the xy-plane with z=0, you should change your lightvector, he wouldn’t work. Generally I use for testing purpose a diagonal vector (like normalize(1,-1,1)) to prevent a parallel direction to my object.

    When I look over your code it seems to me, that you didn’t get the idea of the different spaces, as how you thought 😉 The basic idea of normalmapping is to give additional information about the surface with additional normals. They are saved in a normalmap, so encoded to rgb, where b is usually the up-vector. Now you must fit them into your 3D-world, because they aren’t in the world space, but in the tangent space (tangent space = surface space of the triangle). Because this transformation is more complex, the normal computation goes the other way round. You transform with the normal,binormal and tangent as a matrix your lightvector and viewvector from world space into tangent space (you are mapping the axis of world space xyz to tnb – tangent,normal,binormal, the order can be wrong I usually swap them until it works 😉 ). With your line

    bump = normalize(mul(bump, input.WorldToTangentSpace));
    

    you try to transform you normal in tangent space to tangent space. Change this, so you transform the view and the lightvector in the vertexshader into tangent space and pass the transformed vectors to the pixelshader. There you can do the lightcomputation in tangent space. Maybe read an additional tutorial to normalmapping, then you will get this working! 🙂

    PS: If youre finished with the basic lighting, your specular computation seems to have some errors, too.

    float3 reflect = normalize(2*diffuse*bump-LightDirection);
    

    This line seems to should compute the halfway-vector, but therefore you need the viewvector and shouldn’t use a lightingstrength like diffuse. But a tutorial can explain this in more detail than me now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to use the THREE.ShaderUtils.lib[normal] normal mapping shader, but the lights are
Am trying to parse the RSS feed from www.ted.com/talks/rss, I can access all normal
I'm trying to fadeout a variable and normal element. Independently they do fadeout but
I am trying to create a normal map in opengl that I can load
I'm trying to run MPI programs on 8 machines, but I get the error
I am trying to convert a labda function in normal function but unable to
I'm trying to monitor a normal C program in Monit, but I don't know
Assuming a normal JFrame, I'm trying to get the inset values before the frame
I'm trying to use the same port to serve normal HTTP traffic as well
I am trying to parse a normal link, but sometimes along with that link

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.