Giter Site home page Giter Site logo

shadow-mapping's People

Contributors

haedri 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

shadow-mapping's Issues

directional light direction

Hi haedri, thank you for great tutorials,

I tried to change direction of light at part 2:

from this:

currentLight = new DirectionalLight(this, new Vector3(33, 10, 3), new Vector3(-10, 0, 0));

to this:

currentLight = new DirectionalLight(this, new Vector3(15, 10, 0), new Vector3(0, -10, 0));

However it does not create lighting as expected.

Using this values seems to be working (only x is different):

currentLight = new DirectionalLight(this, new Vector3(15, 10, 0), new Vector3(0.01f, -10, 0));

Maybe there is a bug at the framework, but I did not succeed at finding source of problem yet.

Mistake in tutorial part2 - Creating a depth shader

In my opinion your tutorial of "part2" contains a mistake.

See topic "Creating a depth shader":

Your fragment shader has the following line:

gl_FragColor = vec4(length(v_position.xyz-u_lightPosition)/u_cameraFar);

... and you said:

A darker pixel means the point is farther away from the camera.

But it is the other way round, it is more brighter if the point is farther away.
For instance, "v_position.xyz-u_lightPosition" would be 10 and u_cameraFar would be 10 too. than the result is 10/10 = 1.. the farthest distance possible. This will give us vec4(1.0f) seen as Color (gl_FragColor) would be white, rgba(255,255,255,255).

So your supporting image is also not correct.

Regarding to your source code example the result depthmap-image is also like my assumption.

See my attached image file;

screenshot_depthmap_1

So this part of your tutorial is a little confusing and finally not correct.. it costs me a few hours to find out ;-)

Nevertheless, thank you 'lot for this tutorial!

How to use with custom shaders?

I am trying to make it work with my custom shaders.
I have some model instances and some custom shaders with them. How can this adopt to work with that? I tried everything but I got strange results...

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.