• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by senad · Oct 29, 2012 at 10:46 PM · terrainshadersshader programmingprojectors

Grid Projector only for up-facing normals

I want to project a grid on a terrain surface, but only for the parts that are fairly flat. (especially not on walls and steep parts)

For this, I would like to check in the fragment shader if the normal is up-facing via the dot product.

However, I feel that I do not understand well enough how the projectors work to implement it. Can someone point me to a source describing projetors better? Or push me in the right direction with the shader??

All help is appreciated! :) :)

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by AlvinHerawan · Oct 30, 2012 at 11:56 AM

If what I have in mind is that same as what you are trying to achieve, then I would rather fake the grids that I am trying to project. Here's what I think I will do:

  1. Create another terrain surface mesh/polygon by duplicating the existing terrain in my 3D software (Max, Maya, etc).

  2. Shift this duplicate upward.

  3. Delete the unwanted polygons (the steep parts).

  4. Import this duplicate to Unity.

  5. Create an image (in photoshop or illustrator) that looks like the grids that you are trying to 'project'.

  6. Import this image to Unity.

  7. Create a new material Assets>Create>Material.

  8. Name it 'Grids'.

  9. Change the Shader into "Transparent/Diffuse".

  10. Apple the image created at #5 to the Texture slot.

  11. Adjust the Tiling x and y accordingly to fit into the proportion of your model.

  12. You could also adjust the 'brightness' by changing the Alpha of this material.

I hope I am guessing what you are trying to achieve correctly and I hope this helps.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image senad · Oct 30, 2012 at 04:03 PM 0
Share

Great suggestion, thanks a lot.

I think I will keep the grid projector but let the artists separate the terrain mesh into two layers. It is better to give them more control anyway, deciding by normal might not always be the best solution.

Not exactly what you suggested, but you gave me the right idea. :)

If I should want to have a custom texture for the grid, than I will use your approach. At the moment using the projector looks fine. :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Terrain surfaceshader, or terrain shader supporting multiple lights - need example 0 Answers

Terrain Trees Ignore Projector 0 Answers

where ( or how )can I find the number of instructions used in vertex and pixel shaders in ShaderGraph ? 1 Answer

pixelated water shader 0 Answers

Fog not working in my Shader~ 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges