Hey guys,
I'm preparing for a Shader course I'm going to hold and I wanted to make a showcase video to inspire the students for a stylistic shader project assignment.
Thought I'd share my results with you.
[ame]
http://www.youtube.com/watch?v=r-2YRozCGME&hd=1[/ame]
Please do give me some feedback. I'm still open for modifying this. If anyone wants to play around with it I can make the project available.
Replies
I'll share the project for you guys tomorrow when I'm at work. Don't have the files here.
google search result:
http://www.cs.unc.edu/~feasel/classes/238/238hw4.html
chronic> That seems mighty fancy. I'm going to look into it a bit. Seems like a good way to go if you know exactly what type of crosshatch you want. Do you figure this is less performance requiring? First thing that struck me was "this sounds expensive". But I have only breezed through it.
The nice part about having it a texture as it is now is your end user artist can play around with whatever tileable pattern they like.
Download link
One important thing to set up correctly is the UV set for the hatch texture. It uses a different UV set than the base texture. Texcoord0 is for the base texture and texcoord3 is for the hatch texture. You probably need to manually change the texcoord3 parameter when loading the shader.
My Mental Mill had crashed yesterday so I had to redo a few features, also included normal map support and two additional directional lights in this version.
Please let me know if this works in Max. Also, please do share any cool results you might get out of this
Also tried three new crosshatch patterns.
One idea I have is to use several different hatch patterns for different levels of luminosity.
so it gets hatched on light shading, crosshatched on darker values and very tight crosshatched on the very dark parts! very nice work man
Working on it as we speak!
If I implement this, will you try it for me in Max?
Want to know if the Mental Mill export works well with Max.
This would probably look better with hand drawn hatches. Right now it's just my test textures. Unfortunately does not have flexibility to set your own amount of hatches. You don't have to use all three levels/hatches though.
Download Link
This version retains same functionality as the first one if you don't want to use multiple hatches.
neox> Would be nice if you could render this(suppose you mean offline render?). I think it should be possible. But I'm not sure how. I can save as .xmsl files or export to .cgfx/.fx. I think Mental Mill is supposed to save to a native format for 3DSMax. Does max load .xmsl files?
You could just use a regular static UV set for this, but you would have problems with seams. Is this the look you mean? Or some hybrid between a planar projection following the camera but being a bit bent?
Sorry if I came of sounding defensive about the matter. Please do share ideas and suggestions. I still have your idea in the back of my head, not sure how what to do with it yet.
Did you or anyone else for that matter the Max version a try? Does it work well? All the parameters and slots show up properly and function well?
I'm a Maya user and don't really have access to 3DSMAX, curious to know if Mental Mill easily exports to Max as well. Would be nice to publish for a broader mass.
First of all, some of the text got crop off by the texture slot..probably you can shorten the name/ text by removing the "msl_Sketchy_1_" on the text, leaving only the the "base/ ramp/ etc". I don't know how it suppose to looks like in Maya, so I can't really tell is there any missing part on the parameter or not.
Second, it seems like put the shade on the highlighted area (probably my fault not putting the correct map on correct slot though)..
*Model download from the internet.
Based on the list position top to bottom..
msl_Sketchy_1_bas ............. [ robbie.tga ] ---> base texture
msl_Sketchy_1_ram ............. [ ramp05.png ]
msl_Sketchy_1_ram ............. [ rampSketch05.png ]
msl_Sketchy_1_nor ............. [ skethDanny.004.png ]
msl_Sketchy_1_dar ............. [ hatchDark01.png ]
msl_Sketchy_1_med ............. [ hatchMedium01.png ]
msl_Sketchy_1_ligh ............. [ hatchLight01.png ]
The rest of the setting is still the default..
And owh, it's a mirrored UV..the right one you notice the seam in the middle.
Looking forward for more updates on this!
_Revel
Thank you for trying it out.
There's one parameter missing in your screenshot there which shows up in Maya, which is called "invertY". What it does is pretty much turn the ramp textures upside down if you check it. I think that's why you would need to enable judging by your screenshot. The reason for the parameter not showing is probably because it doesn't have any UI code.
The reason for the long names comes from Mental Mill's naming conventions. That's what I dislike the most about working in that program, it doesn't give you any clean and working UI code when exporting to Max/Maya. I'll add a new version asap which should fix these issues. Should just be some tweaking in a text editor.
Concering the mirrored UV. Did you use the texcoord3 UV set slot with a new UV set for the hatch? Do you have any slots called "texcoord0", "texcoord1", "texcoord2" and "texcoord3" in your material editor? You need to make a secondary UV set for the purpose of the hatch and link that to the texcoord3 slot. This enables you to eliminate any potential seams and also make a dynamic UV projection that follows the camera like I have in my example video (I suppose this is possible in Max as well).
Download link (Maya 002 and Max 003 versions)
I did a quick and dirty conversion of the renderman shader from my previous post - here is that in Maya. not gonna take this further, no free time for it - but those interested should also check out the Nvidia Shader Library, there are similar shader examples.
Edit: Im not gonna share this cgfx shader cause its just a pure copy of someone else's work - doesn't feel right, but it functions as a 'proof of concept'.
Here it is if you haven't saw it before..
Btw, the invertY checkbox is named wrongly, it said "Hatch Pattern Tiling", same like the parameter above it..heheh..
Another thing I notice is that when I apply my normal map to my character, the face orientation/ normal is flipped and I have to purposely flip the normal of all the face in order for it to show the texture (I know it's not a mesh error because when I check it suing Max's xView "face orientation" feature it highlighting all the polys, means all polys flipped)
Is there anything that I should prepare before using your shader to display the hatch pattern?..because I still can't get a result like in your video..and..erm..I'm not sure I quite understand about the "texcoord UV set slot" or "secondary UV set" that you mention in your previous reply..Hope some other Max user can confirm about it working properly in Max or not.
_Revel
Revel> Thanks for trying the new version.
Hard to get everything right when I can't debug it myself
Fixing the UI text is easy. Concering the normal map, did you try to set Normal Map Multiplier to a negative value? Did that solve the issue?
Have you worked with multiple UV sets/channels in max? This is what you need to do. Create a new UV set/channel with a planar map (following camera if you want it fancy). Then you need to use the materials set/channel slot called "texcoord3" and set it to use your newly created set/channel. I don't know how to do this in Max. Maybe someone else can help?
Thanks
Multiple UV set what I think of right now is separating it using MaterialIDs and combine it with Multi/Sub-Object material type, but this will separate the UVs (for example 1 texture for head, another for body) and I don't think this is what you mean. Sorry, but I'm not that expert in Max and yeah a more expert Max user should help you developing this shader even further. I can see a lot of potential use of this sketch shader of yours!
_Revel
Material ID's sounds like different shaders for different polygon faces, and like you said this is not what I referring to.
Ehrm, ok so I try google about "multiple UV set" topic for Max and didn't really get a clear explanation. But I did found some topic about changing the mapping channel, so what I have to do in Max just apply another Unwrap UVW Modifier and change the Map Channel setting to 4, it looks like you hard-coded it to work into that channel, correct?.. (notice you said about texcoord0-3 and use the 3 instead, but in Max there is no map channel 0, it start from 1 so use the 4 instead of 3)..
Here it is in Max, using my Pandaboi character~
Can I request some changing in the order of the map parameter in the material editor?..so instead of hatch dark-medium-light, can you make it hatch light-medium-dark?...it make more sense to me.
Also the naming of the light parameter instead of "msl_light0_direction", "msl_light1_direction", "msl_light2_direction" for the light position, you can make it "Light 1", "Light 2", "Light 3" (less auto-naming programming stuff). The "Invert Y" like I mention earlier, and about the model flipped normal when I applied the shader to my model.
Owh, almost forgot, in Max I can't type negative value into the Normal Map Multiplier. The one that I used on the picture above is Multiplier by 2.
*you can refer what I'm saying to the screen grab of the Max UI that I posted before.
Other than that, it's awesome!:)
EDIT:
One more thing I notice about your shader, it doesn't play nice with omni light. It only light the model based on the viewport that I created it (for example; in top viewport I create an omni light, and it only light the model from the top even though I change the position of the light, this error also applied to front/ left/ etc..) but for spot light and directional light, it works as expected.
_Revel
Glad you liked it and got the map channel figured out. In Maya texcoord0, 1 & 2 are all used by defaul for UV/Binormal/Tagent. That's why it seemed normal to increment and use the next texcoord which is 3. In Max's .fx file it seems to differ, I can try putting it in channel 2 instead.
So just making sure here, the normal map on your panda is inverted right?
So to summarize:
-Rename "InvertY" properly
-Invert normal map functionality (right?)
-Rename light slots to proper names
-Re order dark-medium-light to light-medium-dark
-Switch so R is for Light, G is for Medium and B is for Dark. Makes more sense in that order.
Concering the omni light it doesn't work since there's no point or spot lights added to the shader? I can add some but it makes the shader more sluggish the more lights there are, also clutters the UI which is just one long list of attributes. What lights and how many do you think it useful to have?
Yes, on the screen grab the Panda was inverted normal. And everything on the summary seems cool.
About the light, when I put an omni light from the top viewport, the source of light only from the top even though I move the light to the bottom of the mesh, also if I put from the front viewport the light source is only from the front and cannot be moved following the omni light. But if I use spot/ directional light, when I move the light it self, the light source is following the light as expected.
Owh, I think what you referring to point light is called omni light in Max (the light which don't have any direction and cast ray evenly to every direction), with that said does your shader work with point light in Maya?..because in Max it works only with the type of light which have a light direction (spot and directional light).
If you still confuse with my words tomorrow I try to explain it using pics if you want.
I think 3 lights is enough, can't trade the more option that we have in the shader for more lights support with the Max lagging like hell..heheh..
Btw, thanks for the support on this shader's Max compatibility..I'll be jealous if you only make it for Maya user..
_Revel
If you want a working point/omni light in the shader I will have to add those first. You can't just change them around like you might in Max/Maya.
Now that's explain why when I put omni light I only see a permanent light source position, because when I put it let say in top viewport there is no way to changing the direction of the light because such a feature doesn't exist in omni light parameter. Now, I guess since this is not the official release yet, you can try to add the omni light support in the shader and I try to look into it in Max whether going to cause lagging or not.
Can you make it based on the light position instead of light direction? And I see why you making the parameter of the light in your shader by "light direction" instead of "light position" is for a reason. Xoliul using "light position" in his shader so it support both directional and omni light type, maybe you can apply that to your shader too? Does that sounds easy fix for you?..Cus I have no idea how you gonna do that..again, sorry for my lacks of understanding in coding. Thanks!
_Revel
But ya I notice you're working on your other KoddeShader v2.0, looks nice and seems like everyone love it too...hehehh
_Revel
I'll try to fix the issues I spoke of earlier for a max version. Most of them are cosmetic changes so it shouldn't take forever.
I finally found a few spare minutes at the end of the day at work to fix these issues... hopefully. I still can't debug myself to be sure. Will you try this version?
sketchShader_Maya02_Max05.rar
These are the issues that should be solved:
-Rename "InvertY" properly
-Invert normal map functionality
-Rename light slots to proper names
-Re order dark-medium-light to light-medium-dark
-Switch so R is for Light, G is for Medium and B is for Dark. Makes more sense in that order.
Btw, I'm not too sure with what you said about "invert normal map functionality" because it seems like the previous version is looks better. Sorry if I'm explaining it wrongly but the one that flipped is not the map of the normal map but the object normal it self, as if you manually select all faces and press the "flip" button to flip the faces inside out.
About the UI naming it looks perfect now
_Revel
So the normal map functionality was correct before? But your geometry normals were inverted? And you are sure this is not an error on your end? This behavior is consistent on all models you try on?
Good to hear that the UI is better now.
About the normal map behavior between this release and the previous release I'll try to post up some images later to show you the difference.
_Revel
I don't doubt the normal map functionality is screwed now. I intentionally flipped it as I was previously under the impression it was inverted using the shader in Max.
So I need to reverse the geometry normals and restore normal map functionality as previous version. Correct?
Just to help you visualize my steps to set it up correctly in Max;
1. load a DirectX Shader type and apply your sketch shader
2. plug in all the necessary maps
3. apply unwrap UVW modifier and set a map channel 4 then collapse stack
4. apply the shader to the model
5. select all faces in sub-object mode and hit the Flip button (to correct the inside out looking object)
Here is an image to show you what I mean..
On the left is when the object didn't have sketch shader on it, the right is a same model with sketch shader on it. As you can see the one without shader looks inside out, but the one with sketch shader looks good. Hope it helps!
Looking forward for the next release~
_Revel
yiannisk> Thanks
map name.................[the actual map]
light...........................[dark area]
medium......................[light area]
dark...........................[medium area]
And v06 normal map kinda same with v05 but only when I set the multiplier by 0...multiplier by 1 showing no normal map, and by 2 showing the reverse of multiplier 0.
Another thing I notice all the shader since v03, v05, v06 react negative to the light source direction (facing light source become dark and vise versa). In v03 and v05, if I Flip the object's normal it react ok with the light direction but without any spec (this is why I thought it make the object's normal flipped previously) but different case with v06, it still react negative to the light source direction but when I Flip the face..well, its flipped (looks like the image on the left of my previous post).
kodde, did you have any test object that you familiar with to test this shader?..I'll try it in Max and if possible tell me what test did you usually do and I'll post the result for you to have a look and judge what change to make.
Sorry, but if you think this is just take to much time and you can't debug it yourself and want to stop the conversion to Max shader, I can't do much about it, cus I feel it looks more complicated than I thought at first.
_Revel
I don't think this is going anywhere. I cannot debug it and as I try to fix things it seems to get worse or not work according to what I'm hearing. I think I'll leave it at this. The 03 version seemed to have all functionality working, just cosmetic tweaks.
So you can still use it with max if you want, you just have to live with the cosmetic/ui quirks.
_Revel
I tried the lastest version in max 2010, I placed 3 omni lights in my scene and set them respectively in the shader but it seems to have no effect on the look of the shader...moving the lights around has no effect on it.