If the shading doesn't look right, try changing the proportion of the small value you're offsetting your UVs by, to the small value you're offsetting your position by (the shader has no way of knowing what a small change in UV space is in object or world space, so making sure the proportion between offsets is correct is important) Remember, that normal will be in object space, so make sure to transform it to tangent space (my current project is in 19.2 so the transformation from object to world then from world to tangent is a workaround for a known bug). Set up what I have in the lower right in order to compute the difference vectors, normalize them and take the cross product to find the new normal. Where you had UV plugged in, input the UV plus a very small amount in the U direction (this should be the same one as the tangent vector) for one and the UV plus a very small amount in the V direction (should be the same one as bitangent vector) for the other. Where you had position plugged in, input the position plus the tangent vector times a very small amount for one, and the position plus the bitangent vector times that same small amount for the other. Copy everything else, and paste it twice (good to use subgraphs for this). Take whatever code you're using to generate the new positions isolate the position inputs and the UV inputs. Also, that node playing hide and seek is a Vector 2 node, sorry for the mistake!) (see note at the bottom if you have trouble connecting nodes. Click to expand.It's not 100% perfect but here's the solution I usually use:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |