toon-shading | three.js toon-shading | Graphics library
kandi X-RAY | toon-shading Summary
kandi X-RAY | toon-shading Summary
three.js toon-shading
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Shader wrapper
- handle touchstart events
- handle touch move event
- Handler for mouse down
- Pan the keydown
- Handle touch move .
- Handle mouse move
- Handle mouse move .
- draw an image
- Change the projection scale
toon-shading Key Features
toon-shading Examples and Code Snippets
Community Discussions
Trending Discussions on toon-shading
QUESTION
ANSWER
Answered 2018-Dec-07 at 01:18This type of single-pass view-space technique is necessarily going to produce worse results than the normal-extrusion technique, but in order for it to work at all, you need to get a grip on your coordinate spaces.
What's the aim here? Well, we want to notice when the surface normal is nearly perpendicular to the view direction, and bypass our usual lighting calculations, returning a solid silhouette color instead.
Determining perpendicularity usually means taking dot products, but in (a +Y up, right-handed) view space, the view direction is just (0, 0, -1), V
is just (0, 0, 1), and the dot product between V and the view-space normal is just the z
component of the view-space normal.
With that knowledge in-hand, we just need to make sure we're passing the view-space normal to our fragment shader correctly.
First, change the name of the normal we pass out from the vertex shader to eyeNormal
so we're clear on what space we're operating in. It's then computed as
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install toon-shading
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page