Home Technical Talk

DOTA2 Hero Shader - 3DS Shader Material - RELEASED!

1345
polycounter lvl 12
Offline / Send Message
Ace-Angel polycounter lvl 12
There it goes!

OrgeMagi_23.png
FewesInvokerSet.jpg

NyxSpecularWarp.png

Everything one might need to understand the shader is available in the file. Please go ahead and try it!

Currently confirmed working for 3DS Max and Maya 2009+
Drew++ wrote: »
Hey guys! I went ahead and worked with Ace-Angel, and I rewrote the shader from scratch. That being said, we're going to call this version 2.0+ since it's a complete overhaul.

Features:

-Half-Lambert Diffuse Term with controllable Falloff!
-Additive Rimlighting for make your models pop!
-Phong Specular, non-of-that-Blinn-nonsense!
-Fresnel Ranges from heaven to sea!
-Specular Warp
-Mask support, AS SEEN ON DOTA2!
-All them fancy effects Valve uses!
Changes in Version 2.3
-Changes: Specular and diffuse calculation combined
-Changes: Removed "Custom Fresnel Ranges" for specular and rim terms
-Changes: Reworked "Fresnel Color Warp"
-Changes: Alpha test culling
-Bug: Fixed sRGB read on diffuse/albedo texture and output final lighting in linear color space
-Bug: Fixed some issues with diffuse warp, and other warps. UVW Adresses were not set to "CLAMP" causing artifacts to show ( 3DS Max )
-Added: "Fresnel Warp" texture sampler. This is also known in the .vmt as $fresnelwarp ** NOT to be confused with $freselcolowarp **
-Added: Specular warp
-Added: Option to toggle on Mask 1 and Mask 2, with ideal default values
-Known Issues: Weird issue with diffuse warp( Maya ), strange lines on the model when using IBL cubemap( Maya )
Download Link: https://dl.dropboxusercontent.com/u/853104t0788/Dota2/Dota2Hero_Shader_2.3/Dota2Hero_Shader_2.3.zip

Several Warp textures and other character specific 1D Lookup-Textures are included in the download for ease to use, please note not all characters use them.
How to get them working (For Max)
rz8b1.png

diVZp.jpg

NOTE: PLEASE ENABLE TRANSPARENCY IN YOUR VIEWPORT AND SET THEM TO EITHER SIMPLE OR ABOVE (ei; GOOD), SINCE THE SHADER WON'T WORK WITHOUT THEM WHEN A LIGHT SOURCE IS INSERTED.

parameters.jpg

Cheers peeps and spread the word!

PS: DOTA 2 PC Thread: http://www.polycount.com/forum/showthread.php?t=100016
PS2: DOTA 2 Workshop: http://www.dota2.com/workshop/

Replies

  • lancemaker
    i guess it only works with maya 2013.
  • Nannou
    Offline / Send Message
    Nannou polycounter lvl 5
    Thank you for world peace! This is great.
  • K-PAX
    Offline / Send Message
    K-PAX polycounter lvl 7
    wow,test it now~
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    lancemaker wrote: »
    i guess it only works with maya 2013.

    Did you try it out? I can't confirm which versions of Maya it will work for, but the code *should* work for Maya and Max from 2008+

    If it's throwing an error or anything, screenshot it, and I'll see what I can do.

    EDIT: In the mean-time, I compiled a new version for Maya, if you or anyone else could test it out: http://www.mediafire.com/?0ckd4vlvjtgupe7
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    So this is what you have been working on? :)
    Will try it out now, always wanted that world peace setting, takes it up a notch ;)
  • Drew++
    Offline / Send Message
    Drew++ polycounter lvl 14
    Hey Ace, nice work! I went ahead and threw this up on my ftp, and DropBox! It's easier than that MediaFire link ;)

    https://dl.dropbox.com/u/8510078/DOTA2_Hero_Shader.rar

    http://drewwatts.net/shaders/DOTA2_Hero_Shader.rar
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    Hm... using the glowmask everthing is black exept from the areas with glow.
    When I made the glow map slightly brighter so nothing was completely black, then it worked which makes sense of course.
    Hope you can shine some light on what I might be doing wrong, using 3ds max 2011 x64 btw.

    also is there a reason for specular strength to go into "-" since it does not seem to make a difference.
  • Farfarer
    Yeah, I gave it a go earlier and everything's black (Max 2012 x64).
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Drew++ wrote: »
    Hey Ace, nice work! I went ahead and threw this up on my ftp, and DropBox! It's easier than that MediaFire link ;)

    https://dl.dropbox.com/u/8510078/DOTA2_Hero_Shader.rar

    http://drewwatts.net/shaders/DOTA2_Hero_Shader.rar

    Cheers Drew, will update the first post ASAP!
    Hm... using the glowmask everthing is black exept from the areas with glow.
    When I made the glow map slightly brighter so nothing was completely black, then it worked which makes sense of course.
    Hope you can shine some light on what I might be doing wrong, using 3ds max 2011 x64 btw.

    also is there a reason for specular strength to go into "-" since it does not seem to make a difference.
    Farfarer wrote: »
    Yeah, I gave it a go earlier and everything's black (Max 2012 x64).

    Ah yes, due some complications with the compiler (I'm using a program called ShaderFX), the user it forced to have at least 1 light source in their scene.

    You'll notice that there is also a lack of Ambient slot :P

    If you want I can try and find a way to make it work if you need to, in the meantime, simply pop in at least one light source, set it above the character and voila, it should work.

    As for the - numbers, I have no idea what happened there, I clamped them between 0 and upwards, I'll fix that ASAP and upload a new version as soon as someone can test the Maya version (if not, I will test them MUCH later on).
  • Farfarer
    Yeah, I added a light and set the drop-downs to use it. Still black.
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    same to me, did add a light source.
    Took a look at your code really interesting, trying to learn some stuff myself :)
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Hmm, this is very strange indeed. I just tested it in 2009, 2011 and 2012 x64 and they all work fine.

    Did you guys enable disable Nitrous or Gamma LUT, anything like that?
    Did you guys fillout all the slots, including the Ramp map with the TF2 texture that is provided?
    Mind posting an image with the material next to the model?

    I know that Sven has some problems (EI: The model is too dark), but in general you guys shouldn't be having all these issues, or at least 'see' something and don't need to fill out all the slots.

    Try there, there compiled differently, and I made some very tiny changes:
    https://www.dropbox.com/s/sznmo2e33o8otoj48b/Standard.fx
    https://www.dropbox.com/s/uygm3fiflcl4e6tot5/CG.cgfx
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    I did fill out everything exept the ramp map...
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    I honestly don't know what the issue could be, mind setting up textures, model and scene in folder and pming them to me, 2009, 2011 and 2012 are the versions I tested on, so either one of them should be fine.

    I'm sorry for all the trouble peeps!
  • free-willy_PB
    just tried the latest shader posted up,... maya 2012...works fine for me :), i'll have a proper play tomorrow, much appreciated :)
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    just tried the latest shader posted up,... maya 2012...works fine for me :), i'll have a proper play tomorrow, much appreciated :)
    Finally! Some good news! Glad you liked it!
  • Bigjohn
    Offline / Send Message
    Bigjohn polycounter lvl 11
    Ace-Angel wrote: »
    Features:
    -Phong Specular, non-of-that-Blinn-nonsense!

    What does this mean?
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    ^From what I understood in the Wiki, Valve prefers using a Phong Specular instead of Blinn, as it showcases the bending of the light around edges much better (kinda like Skin), and is cheaper/better looking with mutiple light sources around it.

    Many people who try and replicate Valve-like-shaders, end up using Blinn instead, which makes a huge difference in the look of it.

    Don't worry, I wasn't saying Blinn is inferior, they both have a place and time to be used :D

    EDIT: For those interested, I made an update, check it out.
  • Gestalt
    Offline / Send Message
    Gestalt polycounter lvl 11
    Blinn is more accurate to the specular reflections of real light, it uses the halfway vector. At more glancing angles Blinn specular stretches out as you might see in real life. At the end of the day it all depends on what fits your look, they're both sort of generalizations that are easy to work with to get a result.

    BlinnvsPhong.png
  • pior
    Online / Send Message
    pior grand marshal polycounter
    Hi there -

    Feature wise it looks awesome, but would you mind uploading a reference asset with textures and maybe a screenshot of all the corresponding values ? I have been trying the Max .fx in Max2009 here and even tho things seem to be happening (I can tell that my textures are loading properly, and so on) I couldn't quite tweak the values to get something satisfactory.

    Also on a side note : Maya2008 doesn't load the CGFX. Not that this is a problem at all - but I thought I'd mention it!

    Thanks!
  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    It seems to work when using the ramp texture that's included, so I guess that might have been the "problem" :)
  • Farfarer
    Ace-Angel wrote: »
    ^From what I understood in the Wiki, Valve prefers using a Phong Specular instead of Blinn, as it showcases the bending of the light around edges much better (kinda like Skin), and is cheaper/better looking with mutiple light sources around it.

    Many people who try and replicate Valve-like-shaders, end up using Blinn instead, which makes a huge difference in the look of it.

    Don't worry, I wasn't saying Blinn is inferior, they both have a place and time to be used :D

    EDIT: For those interested, I made an update, check it out.
    Alien Swarm uses this to calc it's specular values (bundled with the rim light values, too) - calculated once per light and then added together;
    void SpecularAndRimTerms( const float3 vWorldNormal, const float3 vLightDir, const float fSpecularExponent, const float3 vEyeDir,
    						  const bool bDoSpecularWarp, in sampler specularWarpSampler, const float fFresnel,
    						  const float3 color, const bool bDoRimLighting, const float fRimExponent,
    
    						  // Outputs
    						  out float3 specularLighting, out float3 rimLighting )
    {
    	rimLighting = float3(0.0f, 0.0f, 0.0f);
    
    	float3 vReflect = reflect( -vEyeDir, vWorldNormal );				// Reflect view through normal
    	float LdotR = saturate(dot( vReflect, vLightDir ));					// L.R	(use half-angle instead?)
    	specularLighting = pow( LdotR, fSpecularExponent );					// Raise to specular exponent
    
    	// Optionally warp as function of scalar specular and fresnel
    	if ( bDoSpecularWarp )
    		specularLighting *= tex2D( specularWarpSampler, float2(specularLighting.x, fFresnel) ); // Sample at { (L.R)^k, fresnel }
    
    	specularLighting *= saturate(dot( vWorldNormal, vLightDir ));		// Mask with N.L
    	specularLighting *= color;											// Modulate with light color
    
    	if ( bDoRimLighting )												// Optionally do rim lighting
    	{
    		rimLighting  = pow( LdotR, fRimExponent );						// Raise to rim exponent
    		rimLighting *= saturate(dot( vWorldNormal, vLightDir ));		// Mask with N.L
    		rimLighting *= color;											// Modulate with light color
    	}
    }
    
    Might be helpful?
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    You're probably best off releasing your SFX project as well Ace, so people can easily change things as well. The compiled ShaderFX code isn't the cleanest or easiest to read.
    Also, to avoid these uninitialized value problems, it's best to have switches/booleans that make sure there's a proper default value.
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    pior wrote: »
    Hi there -

    Feature wise it looks awesome, but would you mind uploading a reference asset with textures and maybe a screenshot of all the corresponding values ? I have been trying the Max .fx in Max2009 here and even tho things seem to be happening (I can tell that my textures are loading properly, and so on) I couldn't quite tweak the values to get something satisfactory.

    Also on a side note : Maya2008 doesn't load the CGFX. Not that this is a problem at all - but I thought I'd mention it!

    Thanks!

    I'll upload a separate folder with examples in it, download that and check it out (I hope Valve is OK with that, I'll use one of the more 'older' models like Sven).

    And thanks! I'll add the info in the Readme about Maya 2008!
    It seems to work when using the ramp texture that's included, so I guess that might have been the "problem" :)

    Aaaah frack it, I guess I'll put in Enable/Disable option then, cheers!
    Farfarer wrote: »
    Alien Swarm uses this to calc it's specular values (bundled with the rim light values, too) - calculated once per light and then added together;
    [/code]Might be helpful?

    Yep, that's heavy code alright, in DOTA2 they did abit differently, as in you either Fresnel Warp a texture (can't confirm if it's an add/lerp or multi), or default to a single color like a traditional rim-light for lower end systems.

    The keyword here is lower-end systems, since they're trying to pop out as much detail as possible without using fancy more then needed outside of basic math (so they keep the specular head-on for many characters, especially pronounced if you enable Specular Bloom).

    I wish I could use a pure Schlick-with-Blinn honestly, pity :(
    Xoliul wrote: »
    You're probably best off releasing your SFX project as well Ace, so people can easily change things as well. The compiled ShaderFX code isn't the cleanest or easiest to read.
    Also, to avoid these uninitialized value problems, it's best to have switches/booleans that make sure there's a proper default value.

    I was thinking of doing that, but Lumonix recently 'closed' down (they moved with Autodesk), so I can't say if I'm allowed to share the SFX files or not (don't want to get in any trouble), especially since I don't own the licensed version.

    I sent them an email, hopefully, they will get back to me about that!

    I think I'm honestly going to do that (Bools), since it would solve alot of issues, but at the same time, almost all of the models in DOTA2 use maps for everything (EI: Ramps, Masks must be 32 with Alpha, etc) so I'm kinda worried about giving people the 'wrong looks' of the model that will looks considerably different if they don't plug-them-in, or help wrong habits (EI: Flip Green channel, etc).

    But you do have a point, it will only get more confusing for beginners, so yeah, I'll include the switch sets.
  • shaderfx
    Offline / Send Message
    shaderfx polycounter lvl 9
    Nice work!

    " allowed to share the SFX files"

    Ofcourse you are allowed to release the SFX.

    I haven't looked at the code but for readability it helps to properly name the nodes in the Shaderfx graph if you havent already.
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    shaderfx wrote: »
    Nice work!

    " allowed to share the SFX files"

    Ofcourse you are allowed to release the SFX.

    I haven't looked at the code but for readability it helps to properly name the nodes in the Shaderfx graph if you havent already.
    Cheers Kees, much appreciated!

    And yeah, I did name the nodes, but I'm pretty terrible at them, most of the time you'll see a math node like this: FresnelxColorxStrenghtxPower :D

    PS: Latest version is up peeps, with an example folder for you too Pior, check them out and see if I missed out on anything.

    Also, for those wondering (few peeps that send me a message), I didn't include or make a Fresnel-Wrap term (meaning having a pure fresnel using a textures instead of a color) since I don't know what Valve used as their final math (you can see what I mean in the Readme), hopefully that should stop people from going crazy while taking a look at the documents.
  • D4V1DC
    Offline / Send Message
    D4V1DC polycounter lvl 18
    Thanks you very much glad to see that this is what you were working on, when I make some dough you'll get a cookie!

    :)

    Time to test this out.

    Edit:
    Works like a charm and then some, wow some amazing work right here, no more headaches.
    uhg means a lot to me, just check the thread, back and forth endlessly now, It's all good in the hood.
    :) You'z da man
  • pior
    Online / Send Message
    pior grand marshal polycounter
    Just tested it in Max2009 - the shader requires the provided example normalmaps to have their Y axis inverted.

    Hope this helps!
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    $!nz wrote: »
    Thanks you very much glad to see that this is what you were working on, when I make some dough you'll get a cookie!

    :)

    Time to test this out.

    Edit:
    Works like a charm and then some, wow some amazing work right here, no more headaches.
    uhg means a lot to me, just check the thread, back and forth endlessly now, It's all good in the hood.
    :) You'z da man

    Haha, yep, quite a few bumps on the road.

    Glad your enjoy, cheers mate :D
    pior wrote: »
    Just tested it in Max2009 - the shader requires the provided example normalmaps to have their Y axis inverted.

    Hope this helps!
    Argh, you're right, I totally forgot about that and was keeping in mind Maya tangents (hopefully that ones works fine).

    Cheers!
  • Autarkis
    Offline / Send Message
    Autarkis polycounter lvl 8
    I'm unable to use it in maya 2012. All other .fx shaders i've tried have worked fine (kodde, lcNextGen)
    It's returning various compile errors, but I've seen a post or two in this thread saying that it worked fine on their install :/
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Autarkis wrote: »
    I'm unable to use it in maya 2012. All other .fx shaders i've tried have worked fine (kodde, lcNextGen)
    It's returning various compile errors, but I've seen a post or two in this thread saying that it worked fine on their install :/

    Did you try the Maya version OR the Optional versions?

    Also, screenshot please.
  • Autarkis
    Offline / Send Message
    Autarkis polycounter lvl 8
    cgfxShader -e -fx "C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx" cgfxShader1;
    // Error: The compile returned an error. // 
    // Error: C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx(508) : error C1031: swizzle mask element not present in operand "b"
    C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx(505) : warning C7011: implicit cast from "float3" to "float2" // 
    // cgfxShaderNode::cgErrorCallBack // 
    // Error: The compile returned an error. // 
    // Error: C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx(508) : error C1031: swizzle mask element not present in operand "b"
    C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx(505) : warning C7011: implicit cast from "float3" to "float2" // 
    // Error: cgfxShader :  "cgfxShader1" unable to load effect "C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx" // 
    

    Here's what Im seeing for the maya version.

    The optional version doesn't work either.
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Autarkis wrote: »
    cgfxShader -e -fx "C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx" cgfxShader1;
    // Error: The compile returned an error. // 
    // Error: C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx(508) : error C1031: swizzle mask element not present in operand "b"
    C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx(505) : warning C7011: implicit cast from "float3" to "float2" // 
    // cgfxShaderNode::cgErrorCallBack // 
    // Error: The compile returned an error. // 
    // Error: C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx(508) : error C1031: swizzle mask element not present in operand "b"
    C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx(505) : warning C7011: implicit cast from "float3" to "float2" // 
    // Error: cgfxShader :  "cgfxShader1" unable to load effect "C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx" // 
    
    Here's what Im seeing for the maya version.

    The optional version doesn't work either.

    OK, so I downloaded Maya and did a test myself, seems like it isn't liking something with the If A=B statement or the textures themselves, OR the plugin could be compiling the code wrong maybe? So I have no idea what I can do about that, sorry, wish I knew.

    BTW, if you use the HLSL-Shader in the Hypershade editor, instead of the CGFX for Maya, it will work (just enable it through your Plugins-Manager) problem is, it will look abit messy and not as good as the Max version, where instead of "..." between certain sections of the parameters, you will get something like "LightDivider", the shader itself and the look of the models remain unaffected, so there is joy in that.

    But it still works, I just have no idea on why Maya's HLSL, CGFX or such are acting weird honestly, or why the CGFX shader is broken, hopefully someone can shed some light, in the meantime, use HLSL shader for Maya.
  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 14
    Maya shader support is just plain bad.
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Xoliul wrote: »
    Maya shader support is just plain bad.
    Man, talk about harsh news in the morning :/

    Cheers, will keep that in mind!
  • Autarkis
    Offline / Send Message
    Autarkis polycounter lvl 8
    I hope the few people that have said it worked on 2012 will tell me what they did (HLSL maybe?)
    Yeah i've always had the impression that maya shader support was bad compared to max. I guess I could always ask to get a floating license to use Max at home ;)
    Thanks for your hard work Ace-Angel!
  • deolol
    Offline / Send Message
    deolol polycounter lvl 6
    could someone post a tutorial on how to set it up on maya, just so we can test it out? Thanks!

    I don't even know how to try the shader lol
  • haiddasalami
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Ace-Angel wrote: »
    But it still works, I just have no idea on why Maya's HLSL, CGFX or such are acting weird honestly, or why the CGFX shader is broken, hopefully someone can shed some light, in the meantime, use HLSL shader for Maya.

    Its actually the other way around. The HLSL plugin usually causes more problems haha.
  • Autarkis
    Offline / Send Message
    Autarkis polycounter lvl 8
    Ace-Angel wrote: »
    BTW, if you use the HLSL-Shader in the Hypershade editor, instead of the CGFX for Maya, it will work (just enable it through your Plugins-Manager) problem is, it will look abit messy and not as good as the Max version, where instead of "..." between certain sections of the parameters, you will get something like "LightDivider", the shader itself and the look of the models remain unaffected, so there is joy in that.

    Here's what Im seeing using HLSL in maya..
    Error trying to create effect C:/Users/Autarkis/Desktop/DOTA2_Hero_Shader/DOTA2_Hero_Shader_Maya.cgfx:
    	C:\Users\Autarkis\Desktop\DOTA2_Hero_Shader\DOTA2_Hero_Shader_Maya.cgfx(505,9): warning X3206: implicit truncation of vector type
    C:\Users\Autarkis\Desktop\DOTA2_Hero_Shader\DOTA2_Hero_Shader_Maya.cgfx(508,61): error X3018: invalid subscript 'b'
    

    /sighs. Sometimes I hate maya!

    DeoLol:

    Go into plug-in manager in Maya and load the cgfxshader.mll and hlslshader.mll.
    In the hypershade, create either node ( apparently HLSL works and CgFX doesn't) and load the DOTA2 shader file into it and it should work.
  • Drew++
    Offline / Send Message
    Drew++ polycounter lvl 14
    Hey guys! I went ahead and worked with Ace-Angel, and I rewrote the shader from scratch. That being said, we're going to call this version 2.0 since it's a complete overhaul.

    Download!

    https://dl.dropbox.com/u/8510078/Dota2/Dota2Hero_Shader_2.0.rar

    Changes in Version 2.0
    -Shader is now completely written from scratch!
    -Support: Maya Support with some limitations due to the compiler profile. Diffuse warp, and Fresnel warp might not work, depending on your card. Working on resolving these issues...
    -Features: Diffuse Warp, Fresnel Warp, Normals, Mask 1 & 2, Detail Texture, Specular Exponent and Scale, Rim light Color and Scale, Ambient IBL, Ambient Light
    -Added: Fresnel Warp
    -Added: Invert green channel for normals
    -Added: Specular exponent and scale
    -Added: Rim light scale
    -Added: Ambient Light with Ambient IBL Cubemap support

    https://dl.dropbox.com/u/8510078/Dota2/parameters.jpg

    Dota2HeroShader2.0.jpg
    diffusewarp.gif
    fresnelwarp.gif
    ambientcube.gif

    If anyone has any problems, just post here! :)
  • Autarkis
    Offline / Send Message
    Autarkis polycounter lvl 8
    I'll be damned, works now. A lot of thanks to Drew and Ace-Angel!
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Nice! Glad to see it's working! Although, all thanks should go to Drew since he tackled Maya head-on :P

    On a related note, if anyone takes awesome pictures with this shader, do post them here, would very much like to make a banner with them :D
  • shriker
    Hey guys thanx for the awesome work! I just one to point out 1 thing i banged my head upon in maya. The shader doesn't work if your objects' uv map isn't called "map1". Gives all kinds of wierd results or just black. When i figured this out it all works like charm :)
    i hope this helps if someone runs into the same problem
    Cheers
  • EtotheRic
    Offline / Send Message
    EtotheRic polycounter lvl 18
    Hey, this is great, thank you for putting it together! I had the chance to tinker around with it today. My next armor set I want to do is for Disruptor so I am starting out fresh with the default assets to try out the shader on. I am using Maya 2011 so I thought I'd share a few of my findings. I also had a few questions about the shader functionality if you don't mind. I don't have Max installed to look at the sample scene unfortunately so I'm making a best guess here at how things work.

    Maya specific:
    -Initially the model displayed with black diffuse but I found plugging in a point light to the light 1 position fixed this.
    -Lights are treated as point lights (non-directional)
    -When I duplicate a shading network maya unloads the cgfx file on the duplicate so you have to click the "reload" button
    -the model display in the viewport gets wacky looking if I rotate the model so I keyframed the lightgroup rotating around the model.


    Shader specific questions:
    -Is the position/rotation of the rimlight adjustable?
    -Should we use juggernaut_lightwarp.tga for all the shaders and both diffuse and fresnel warp slots?
    -Any other settings I should edit? (or tips)

    I'll probably play around with the settings some more to get a better likeness to the in-game but so far it seems good. The 3rd light slot is still open as well.

    Screengrab of Maya viewport, player select and in-game:
    cgfx_shader.jpg
    Thanks!
  • Ace-Angel
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Cheers Shriker, thanks for the info!

    Hey Ethohe, I can't really say per se about Maya and why these issues are coming to light (pun intended), but I'll try my best to answer them.

    -This is a weird one indeed, hopefully Drew can fill you in, but I think we decided to go with a light-requirement (EI: You need at least 1 light to show your model properly) setup since DOTA2 always has one source of light ontop of the character, but having your model be outright black is weird, it could be a bug that needs squashing. I think it could be a Maya specific bug.

    -Mind telling what is happening exactly in terms of looks? In most cases, point lights in Maya or Max should act like directional, respecting the location and direction they're emitting the light from, same with other light sources, unless you mean you're getting a lack of directional light shadows, in which case, we kinda decided to skimp on shadows since they're somewhat buggy.

    -I'm not sure about this one, Maya shouldn't be unloading or reloading anything by-itself (unless they included some fancy new thing in the latest SP patches). Does this happen all the time, after a fresh scene, or sometimes?

    -Thats a bug to which I experienced in newer versions of both Max and Maya, I'm not sure what is causing it, but if you could try this: Freeze transform > Rotate Model; If model gets wacky > Freeze transform (or equivalent of Reset XForm from Max). If this works, then it's an Autodesk issue, in worst cases, it could be a Valve/Import issue, since in my case, Importing the newer FBX versions of the model in an older importer like Max 2009 will also cause the same issues.


    -No it isn't, and the reason for that is because Valve made it like that for optimization (we tried to keep it close to it as possible). However, if you want to the Rimlight to be on certain parts of your model vs. non-in others, then you need to create your own Mask in Mask-2 channel G. That's how Valve did it the "More Rim ontop, less on the bottom" look, I think they used an AO and Spec map together to make the mask.

    -You can use it, although I would suggest not using anything in Ramp in the mean-time, since each model has it's own Lightwrap map which does really change the look of the model (EI: Sven has a very blue warp, in some characters even pink!). Juggernaut currently has the more complicated one, and it's missing a couple of texture maps for the body and the fur, so it can throw things off, especially on other models.

    If you want, I can create a dump from DOTA2 of all the Ramp maps for the Heroes as well the Fresnel Warp, since each has their own, maybe include the VMT files which tell you stuff like color of the Rimlight, Specular exponent, etc.

    Cheers and thanks for the feedback!
  • Drew++
    Offline / Send Message
    Drew++ polycounter lvl 14
    -I'm sure it's a Maya specific thing with the lights. I'll have to work out how to send the default light into the shader... Otherwise you need to define one for the shader to pull one. I'll have to work out a cunning plan to fix this.
    Next version will have this fix!

    - Valve does use a interesting rim light... They square it ( rim * rim ), and I think they might mask it by the regular diffuse light ( dot(Normal, LightVector), I didn't do that. Now that I tested it out, It's looking closer to what you're showing from the game :V
    rimlight.gif
    Here is that shader edited! https://dl.dropbox.com/u/8510078/Dota2/Dota2Hero_Shader_2.0.rar

    - As far as I know Valve just used a regular rim with no Fresnel, but I could be wrong! You can control it's intensity/scale there... Basically it's just a multiplier.

    - Fresnel warp would use a 3D warp texture, such as hue_shift_90_degrees... You don't have to use the Fresnel warp, since it's only on a select handful of characters. Unfortunately I don't have access to the Fresnel warps from the game in proper "volume-texture" form, which is absolutely necessary. Would be neat if I did! * on a site note! * The diffuse and Fresnel warp effects are showing errors a inside Maya. Not sure why. I'm working on fixing that! :(


    - You can use "juggernaut_lightwarp.tga" for the diffuse light warp only, since it's just a 2D thing, not 3D. Although, if you can extract some of the warps from the game you can use those :)

    Here is a simple "identity" 3D Texture. This one won't change the color of the Fresnel.
    3D_Texture_128.png

    Throw it on top of an image of screenshot of your character in Photoshop and apply as many adjustment layers on top!
    example.jpg

    Here are the settings for .DDS Export. It MUST be a volume texture! Can be any bits, the only problem is you start to lose accuracy, resulting in some color errors :)
    exportSettings.jpg

    Hope this explains the 3D Fresnel Color Warp tetxure to people!
  • PoPcorn
    I tried getting this to work for Maya when you first released it with not much luck.

    Now that EtotheRic is able to achieve a great look with the updated shader I'm really excited to give it another go.

    Thanks for the hard work.

    What would be the best way to take renders with this shader in Maya? Is there a way to take high-res real time screenshots in Maya?
  • Boonta
    Offline / Send Message
    Boonta polycounter lvl 13
    amazing, will be testing this tonight! thanks heaps for this :D
  • shriker
    PoPcorn with maya hardware render you can render any resolution you want and it gives pretty nice results ... and rendertime is about a second per frame :D
  • Farfarer
    Drew++ wrote: »
    - Valve does use a interesting rim light... They square it ( rim * rim ), and I think they might mask it by the regular diffuse light ( dot(Normal, LightVector), I didn't do that. Now that I tested it out, It's looking closer to what you're showing from the game :V
    Maybe by dot product of view and light orthonormalized to view?
    float3 lightOrtho = lightDir - viewDir * dot(lightDir, viewDir);
    rim *= saturate(dot(lightOrtho, viewDir);
    

    That'd make it directional (unless the light is directly infront or behind the camera, then it halos out like regular rim light), but also constant.
1345
Sign In or Register to comment.