Coder Social home page Coder Social logo

habrador / unity-advanced-shaders-tutorial Goto Github PK

View Code? Open in Web Editor NEW
48.0 4.0 6.0 10.02 MB

Implementation of advanced shaders in Unity like raytracing, interior mapping, parallax mapping

Home Page: https://www.habrador.com/tutorials/shaders/

License: MIT License

GLSL 31.43% C# 12.61% ShaderLab 55.96%
raytracing unity-tutorials unity3d interior-mapping parallax-mapping open-source unity-shaders star-wars death-star

unity-advanced-shaders-tutorial's Introduction

Hi!

Welcome to the #6135 most starred GitHub account in the world (Source) and the #126 most followed account in Sweden (Source)!

GitHub Repo stars

The one who's running the show is me, Erik Nordeus. I'm an imagineer (creative engineer) who's interested in the intersection between art and engineering. I design mostly Unity and Blender projects. After finishing my mandatory military service, defending King and country, I got a master's degree in Mechanical Engineering from the Royal Institute of Technology (KTH) in Stockholm, Sweden, where I also live. The rest is history...

My goal with my open source projects is that the code should by as easy as possible for you to understand, so I love to comment it! I once wrote a book about a guy called Elon Musk, and I read somewhere that authors are the best at commenting code because they know how to explain complicated topics in a simple way. Thus I hope I will fulfill my promises!

Connect With Me

Experiences

Languages: C# • Python • JavaScript • HTML • CSS • MATLAB • PHP • MySQL

Tools: Visual StudioBlenderUnityKrita

FAQ

  • Are you related to the company Nordeus? No, my surname Nordeus is a family name. If you googled Nordeus before the Nordeus company was founded you could only find people with that name in Sweden, so I'm not sure how they got the name. But they follow me on Twitter! Kinda funny that both of us are into Unity.

THANK YOU...

...everyone who has used and contributed to my open source projects!

If you use the code for something cool then you can @ me on twitter.com/eriknordeus and I promise to retweet!

unity-advanced-shaders-tutorial's People

Contributors

habrador avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

unity-advanced-shaders-tutorial's Issues

Parallax shader visual depth changes depending on view angle

Thank you for this great tutorial. I am new to shaders and it is really a huge help.
I played with the parallax shaders and discovered that their visual depth is changing depending on the view position. The sharper the view angle, the less deep they look.
My guess is that stepDistance should depend on view direction, actually we should travel along the ray the longer the sharper the view angle to reach imaginary intersection with next layer.
I added following modifications which seem to fix the issue:

  struct Input 
  {
	  //What Unity can give you
	  float2 uv_NoiseTex;
  
	  //What you have to calculate yourself
	  //The camera direction in tangent space
	  float3 tangentViewDir;
	  // cos of view direction to surface normal
	  float cos;
  };

in vert:
o.cos = -dot(normalize(worldViewDir), normalize(worldNormal));
and in surf:
float stepDistance = 0.01/ IN.cos;

I am not sure this is an optimal solution, so please review. Thank you again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.