KajiyaKay shader #8881

Closed
opened 2008-04-05 06:07:15 +02:00 by Andre Susano Pinto · 13 comments

%%%Well LetterRip asked who was willing to try to implement a KajiyaKay

so here it is...

I did some renders.. it looked fine.. (but i can't notice very much difference.. all shaders look nice according to me)

I think light is working correctly at least it produces results similar to others shaders.

Maybe the correct way would be to implement some shader that has subsurface scattering into account.. (I'll try to look onto that if i have time)

(Also I'm not sure where we need a kajiyakay diffuse part.. probably other diffuse shader has the same behaviour..)

Note: both kajiyakay shader (diff and specular) assume they get a tangent.. this means applying one of those shaders to a surface that does not produces tangents is not advised...
So having "Use tangent shading" or "Tangent" options enabled is the right way of using this shaders.

%%%

%%%Well LetterRip asked who was willing to try to implement a KajiyaKay so here it is... I did some renders.. it looked fine.. (but i can't notice very much difference.. all shaders look nice according to me) I think light is working correctly at least it produces results similar to others shaders. Maybe the correct way would be to implement some shader that has subsurface scattering into account.. (I'll try to look onto that if i have time) (Also I'm not sure where we need a kajiyakay diffuse part.. probably other diffuse shader has the same behaviour..) Note: both kajiyakay shader (diff and specular) assume they get a tangent.. this means applying one of those shaders to a surface that does not produces tangents is not advised... So having "Use tangent shading" or "Tangent" options enabled is the right way of using this shaders. %%%

Changed status to: 'Open'

Changed status to: 'Open'
Member

%%%Hi Brecht, maybe you can have a look at this...%%%

%%%Hi Brecht, maybe you can have a look at this...%%%
Member

%%%attaching an example of the hair with the shader applied%%%

%%%attaching an example of the hair with the shader applied%%%

%%%Well I attached images that better demonstrate the shader
(before the hardness was near 0.. now it was rendered with hardness=30)

Also attached the blend used for rendering the images.

hardness = 30
0005_shader.png => (strand->use tangent shading)
0005_v_shader.png => (strand->use tangent shading, tangent v)%%%

%%%Well I attached images that better demonstrate the shader (before the hardness was near 0.. now it was rendered with hardness=30) Also attached the blend used for rendering the images. hardness = 30 0005_shader.png => (strand->use tangent shading) 0005_v_shader.png => (strand->use tangent shading, tangent v)%%%

%%%Really interesting.
I remember a thing,really odd about hair shading.
Sometimes ago(I think 2 years ago)someone was working on an anisotropic shading for blender,no uv based.At that time Ton started working at the particles,he did the basic of the new particles shading and testing particles shading combined with that anisotropic shader give good result,if I remenber well better that how work now(the specular now is really difficoult to control is always to big).
If you want work on hair shading imho you should look here:
http://graphics.stanford.edu/papers/hair/
I have used a shader derived from this paper(daniel rind hair shader for mental ray)and work really well,I think is the way to go.
Btw,I'll try to test your patch as soon as possible.
%%%

%%%Really interesting. I remember a thing,really odd about hair shading. Sometimes ago(I think 2 years ago)someone was working on an anisotropic shading for blender,no uv based.At that time Ton started working at the particles,he did the basic of the new particles shading and testing particles shading combined with that anisotropic shader give good result,if I remenber well better that how work now(the specular now is really difficoult to control is always to big). If you want work on hair shading imho you should look here: http://graphics.stanford.edu/papers/hair/ I have used a shader derived from this paper(daniel rind hair shader for mental ray)and work really well,I think is the way to go. Btw,I'll try to test your patch as soon as possible. %%%
Member

%%%any artist testing done?%%%

%%%any artist testing done?%%%

%%%Hi,I have done some test yesterday.It seems your diffuse shader is darker than other diffuse shader,that can be useful as hair are more specular than diffuse.
The specular seems strange,Blender specular shaders are more aligned to the perperdicular direction for the hair,it appears this shader rotate a bit that direction,it looks a bit odd(maybe it's more correct,I don't know).
%%%

%%%Hi,I have done some test yesterday.It seems your diffuse shader is darker than other diffuse shader,that can be useful as hair are more specular than diffuse. The specular seems strange,Blender specular shaders are more aligned to the perperdicular direction for the hair,it appears this shader rotate a bit that direction,it looks a bit odd(maybe it's more correct,I don't know). %%%
Member

%%%feedback from harkyman

I tried the KK shader patch out last night with all of the characters in my animation. My first impression is that it probably produces more natural results for hair and fur than what I'm currently using. However, the lighting schemes and other material settings I've developed for my characters were really optimized for the shortcomings of the current shaders for use with hair. That said, I didn't have time to reconstruct everything and really optimize the situation for the KK shader. It clearly produces different results than shaders I was using, and if it had been available at the start of my project I almost certainly would have used it.%%%

%%%feedback from harkyman I tried the KK shader patch out last night with all of the characters in my animation. My first impression is that it probably produces more natural results for hair and fur than what I'm currently using. However, the lighting schemes and other material settings I've developed for my characters were really optimized for the shortcomings of the current shaders for use with hair. That said, I didn't have time to reconstruct everything and really optimize the situation for the KK shader. It clearly produces different results than shaders I was using, and if it had been available at the start of my project I almost certainly would have used it.%%%

%%%Here 2 images(only specular,same camera)on your test scene to explain better what I mean

Cook/Torrance specular

http://img392.imageshack.us/my.php?image=cookhw1.png

Kajiya

http://img135.imageshack.us/my.php?image=kajiyaix0.png

Cook/Torrance seems to me better.
Bye

%%%

%%%Here 2 images(only specular,same camera)on your test scene to explain better what I mean Cook/Torrance specular http://img392.imageshack.us/my.php?image=cookhw1.png Kajiya http://img135.imageshack.us/my.php?image=kajiyaix0.png Cook/Torrance seems to me better. Bye %%%

%%%Also just did a test with the attached blend file, disabling shadows and making all hairs use the same material. To me the specular highlights appear to be in the wrong place for Kajiya-Kay?

Kajiya: http://users.pandora.be/blendix/kk_hair.png
Blinn: http://users.pandora.be/blendix/blinn_hair.png
%%%

%%%Also just did a test with the attached blend file, disabling shadows and making all hairs use the same material. To me the specular highlights appear to be in the wrong place for Kajiya-Kay? Kajiya: http://users.pandora.be/blendix/kk_hair.png Blinn: http://users.pandora.be/blendix/blinn_hair.png %%%

%%%
I tried 2 things on the KK shader..

  1. I normalized the vars I receive on KajiyaKay_Spec
    (I thought the vectors were already supposed to be unit but it turned out not to be true.. I reported it as a bug here: http://projects.blender.org/tracker/index.php?func=detail&aid=8949&group_id=9&atid=125)

  2. It seems blender was converting back to vertex normal after calculating the diffuse part, this means the tangent used on diffuse is diferent from tangent on specular:
    (I don't understand the reason behind this and it would be nice someone to explain me.. so that i can understand what tangent i should feed to the KK shader)

    vn= shi->vn; // bring back original vector, we use special specular shaders for tangent
    if(ma->mode & MA_TANGENT_V)
    vn= shi->tang;

Here are the outputs:

kk shader:

normalized vars and using same tangent as diffuse:
http://imagebin.org/16281

and using the tangent that other specular shaders use:
http://imagebin.org/16296

Still I don't know why specular shaders use other tangents, I'd really like to know.. to better understand if the shader is still giving wrong results :S%%%

%%% I tried 2 things on the KK shader.. 1) I normalized the vars I receive on KajiyaKay_Spec (I thought the vectors were already supposed to be unit but it turned out not to be true.. I reported it as a bug here: http://projects.blender.org/tracker/index.php?func=detail&aid=8949&group_id=9&atid=125) 2) It seems blender was converting back to vertex normal after calculating the diffuse part, this means the tangent used on diffuse is diferent from tangent on specular: (I don't understand the reason behind this and it would be nice someone to explain me.. so that i can understand what tangent i should feed to the KK shader) vn= shi->vn; // bring back original vector, we use special specular shaders for tangent if(ma->mode & MA_TANGENT_V) vn= shi->tang; Here are the outputs: kk shader: normalized vars and using same tangent as diffuse: http://imagebin.org/16281 and using the tangent that other specular shaders use: http://imagebin.org/16296 Still I don't know why specular shaders use other tangents, I'd really like to know.. to better understand if the shader is still giving wrong results :S%%%
Member

%%%Closing inactive report. Andre: please re-open when there's a working patch you like to present.%%%

%%%Closing inactive report. Andre: please re-open when there's a working patch you like to present.%%%
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#8881
No description provided.