Coder Social home page Coder Social logo

help shadows optix7 about lighthouse2 HOT 5 CLOSED

jbikker avatar jbikker commented on May 17, 2024
help shadows optix7

from lighthouse2.

Comments (5)

PerspectivesLab avatar PerspectivesLab commented on May 17, 2024

ok i figured out ! i was applying a scale a root node level in the gltf file that was misleading the shadow calculations, the solution was to apply scale directly at vertex level, and then exporting to gltf

from lighthouse2.

PerspectivesLab avatar PerspectivesLab commented on May 17, 2024

it seems while applying a scale to the model ( ex 0.5,0.5,0.5 ), that the source matrix calculation is causing incorrect results for shadows/shade/ambient:
in rendercore.cpp

			if (instance->transform)
			{
				T = mat4::Identity();
				memcpy( &T, instance->transform , 12* sizeof( float ) );
				invT = T.Inverted();  

			}
			else
			{
				T = mat4::Identity();
				invT = mat4::Identity();
			} 

if i use only:

				T = mat4::Identity();
				invT = mat4::Identity();

the shadows/ambient are working
could you comfirm you have the same behaviour with the gltf model provided ? with rendercore optix 7.0.
how can i make model transform scale work ? thx

from lighthouse2.

PerspectivesLab avatar PerspectivesLab commented on May 17, 2024

ok i created a pull request for that, let me know if it goes through, thx

from lighthouse2.

jbikker avatar jbikker commented on May 17, 2024

Sorry for the late reply, I missed your comment.
I think the issue is a bit deeper: when using a transform on instances the shading code must take this into account for normals by applying the same transform to these vectors. Or more accurately, to obtain corect transformed normals the inverse of the transpose of the transform must be applied. This is the same as the transform itself for orthonormal matrices, but scale matrices are not orthonormal...
I will fix this in the new year. In the meantime: the fix you proposed will not work if the model is rotated, but for now it should indeed solve your problem.

from lighthouse2.

jbikker avatar jbikker commented on May 17, 2024

I have committed a couple of fixes that should resolve your problem. I will close the issue now; if it turns out your problem persists please reopen it.

from lighthouse2.

Related Issues (20)

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.