Learn stylized shading with Shader Graph - Unite Copenhagen

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay hello everyone I'm gonna start very soon maybe now so my talk is to tell you how I created some stylized shading with shader graph first Who am I I'm Shiro Contini CEO I'm lead evangelist for the region of EMEA I focus on games unity for games and specifically I like to speak about how to use unity and how to use unity in a more advanced way so taking the features and using them in a more advanced way in the past I was a developer of my own games with my own company and a certification tester at EA Madrid so in this presentation I'm gonna go over how to get light and shading information through custom hlsl code in shader graph then I'm gonna use that to show you how to create a custom tuned shader specifically a specific type and then here and there I'm gonna give you some tips on how to improve your production workflow when using shader graph so Sheila graph is available as part of the SR piece is a visual based visual shader editor node based it's now out of preview I just wanted to reiterate that so that means that is used it's a good to use in production you probably seen shader graph here and there we used it in so many demos and one of them was this demo attached to the blog post showing you controlling iridescent and you know other interesting feature of HDR P with shader graph but the thing is sometimes you don't want to do a realistic rendering you want you want a stylized one there are many games that do that these are just a few examples of made with unity games a pretty recent one recent ones actually as you can see from like the completely stylized to something here on the right circuit Superstars which is a bit more you still see some realistic elements but then there's a stylized overlay on top what is a stylized look what do I mean by that so stylized means something that doesn't necessarily look real you after the surface response to shadows and light in a specific way which is what I'm gonna do sometimes you add abstract details on top like an outline the reason for pursuing a stylized look is maybe so sorry another thing you do is exaggerate and remove details and the reason for that is maybe you want to direct the viewers attention to some specific details so by by tweaking them you were able to do that maybe you want to make the game especially games right you want the action to be easier to read so by stylizing it you you direct people's focus and it make it easier for them to read especially on mobile devices on smaller screens and especially on mobile devices it's a good way to still look cool even when the hardware is less powerful so you don't use the full power of PBR but you go a different direction but you still have a distinct look so recreating a to shader Nishida graph the objective of this talk of what I've done it was to recreate a shader as it was as you seen it in the Legend of Zelda breadth of the world the latest biggest big zelda installment the first step so this thing has several steps it's a complex piece of work the first step is actually interfacing your shader graph with the rendering pipeline to get light and shadow information so how do we do that we need to do it use a little trick we need to write some custom eachother circle and we do that through the custom function node which is this one highlighted here so the custom function node is a special node in shadow graph that allows you to insert some HLSL code in two ways you can do it within the node so as you see here you see some equals a plus B that's a little piece of HLSL or you can do it from an external hlsl file so I start with that and I start putting in some custom code by the way this code I will be sharing it later during the presentation so don't worry too much about you know taking photos as I talk so the first piece here is this little little snippet of code as you can see it's made of two branches because the shada graph and the custom function note gives us the ability to define you see that that is a compiled directive the shadowgraph preview it's saying basically if you are in shada graph if it's a shell graph preview use this piece of code if you're not use this other piece of code and so the difference between those two piece of code pieces of code is that the second block you see it's as light get main light that's a function of the pipeline so that's a function that through which the pipeline will restitute the main light in the scene and it's not available in shader graph so the first piece of code the first block is basically faking the data so while you're in shader graph you fake the data when you're in the scene you actually get the main light and that's why you have two blocks so in the first case the data is kind of like hard-coded if you want the data that we're interested in is the direction and the color of the light so we get a vector3 or float tree in shader terms and a color for this toon shader we're using the Lambert lighting model which is one of the simplest lighting model around this piece of code instead sorry comes from the the universal render pipeline itself you see the you the URL if you want the address of the file in blue so basically this is the interesting part you can go into the library and find these functions and use them in your shader graph because obviously universal rendering pipeline like all packages that we released is open source that you have the source on your machine so you can dive in and find this function and use them in your graph so in here as you can see in this Lambert lighting model which you can find in the universal rendering pipeline we're using a dot product of whoops I don't have it highlighted but I can do it with the mouse dot product of the normal of the model and the light direction that we got before with our custom code just as a refresher if you don't know what the dot product is is basically the idea of finding how much two vectors are facing the same direction so if vector a is my target I by doing the dot product of the two I find out how much B is facing in the same direction and so depending on how much they're matching you get different values right and the values can go from one if they're looking exactly the same way to zero if they're perpendicular and it can also be minus one if they're looking in different directions that's the basics of the of the shader but I don't want to use the code that I showed you before I want to remake it into a graph so I simply do exactly that I take you see the normal and the light direction that I got from my custom function node and I do the dot product of the two of them so you see how we're basically matching what was done in code in the pipeline with nodes so I'm recreating the same Lambert lighting model with my nodes and then I saturate which means I cut values that are below 0 and above 1 and then I multiply them multiply them by the color so I'm using this value here which is going to be at 0 to 1 which is kind of like a mask if you want multiplied by the color and I obtain the final color of the surface and we get something like this so we get a very simple light to dark transition and then all of the part on the dark side is black then we want add shadows and shadows are a bit more complicated so again you can find this part of this code in the pipeline and I will show you later the only thing I want to show you show you here is two different extra variables that we get as a result of this calculation which is the distance attenuation and the shadow attenuation to floats where in this case itself but that's the precision so two numbers right the only thing we have to do here when we calculate shadows you usually have to provide the word position because the shader has to know where the object is located in the world to be able to calculate the shadow in that specific point so you have an extra input here at this point when you start working with big chunks of code it's really uncomfortable to work in the little box in the shadow graph so you want to switch the custom function node to file mode as I said before there's two ways of putting HLSL in shadow gray in the custom function node the second one is file is custom sorry his file mode you see it here at the bottom you select file and then you're able to connect a file that there is in your project and from there you can call different functions in that file so you can have as many functions as you want and as long as the input and outputs match so in this case you see I talked about the two extra values before distance and shadow attenuation there here and the extra input is here so as long as inputs and outputs match with your code the custom functional is gonna take that code and put it in the graph the cool thing with obviously with file mode is that you get syntax errors directly into shader graph and but you can work in your IDE of choice and you get syntax highlighting so now we have this situation it's a bit more complicated it's again Lambert lighting but with shadows so here at the bottom you have these two extra multiply nodes which are multiplying the distance and the shadow attenuation getting a final shadow value multiply them by the color and then finally multiplying them by the the result of the lighting and we get something like this we get again like the same simple lighting model but now it can cast shadow on each other now this is a good moment to stop and think as you work on the custom function node and this may be this custom functional is something that you want to reuse over and over again in different graphs because you're gonna create like different stylized shaders that are slightly different it's a good moment to put these custom function nodes and its input the word position into a sub graph so that's what I did so I encapsulated the two into the sub graph I bring all the outputs as they are and then now that's how my graph looks like so I lost some complexity here and it looks a bit simpler so this is now the sub graph that's containing the custom function node one thing I want to point out here is then before I said that I got this value the dot product and I will saturate it so I will cut all the values outside zero and one because that's normally what you want like a light that goes from full light to zero but for the purpose of my stylized shader I could have some use for the values that go below one so actually kept them so I removed the saturation part because the thing is on the screen it might look that this is now zero value and this is zero value and then you have the values that go from zero to one but in reality when you calculate the dot product these values go from minus 1 to 0 and I have some use for it so that's why I removed the saturate node and again just because I'm doing stylized shading normally I wouldn't care but like for my purposes that makes sense and then as you work with these funky values right that has no they have no visual representation because what does minus 1 mean in terms of lighting is it built is it darker than black how does it work so a good tip to that I want to give you is that you can shade your model with the custom gradient and for example I use this one which is like goes from red to black and then to blue and this represents my values so as I bring the values in here and I expect values that go from minus 1 to 1 right the dot product I remap them to 0 to 1 to read from this gradient so minus 1 will now be here point minus 1 will be here at 0 will be here and 1 will be here and I use these to shade my models as I'm working on the shader so I get a visual representation of what's actually happening because sometimes we shed it's a bit hard to debug you don't have a debug dot log and you can output values so you need to see them in the scene next step we want to calculate a simple specular function so the specular of course is the bright point of light that you see on surfaces when there's like a strong light and again this code comes from sorry this is the code that I'm gonna use in the shade graph as you can see shader graph preview I'm using at zero value so I'm not I don't I won't have any specular in the graph and then the values here are calculated you in this function here you see lighting specular oops sorry this is the inputs lighting specular is another function that comes from the pipeline so again I'm tapping into the pipeline with pre-made functions and then I just use them for my for my graph and if we dive into the pipeline that's what it looks like again you don't need any need to care about what it's doing here but it's nice to know that it's there for you to modify and look at if you want it's actually the same lighting dot hlsl and the the key to specular is this thing is the health vector so when you calculate a specular it depends on the view direction so depending on where you look up which direction you look at the object from and then the health direction so it looks a little something like this so you look at the object from a certain point of view and you hit a certain spot on the on the surface and then you have the light direction which points in turn in another so it comes from another direction and the specular basically appears in between so in between these two vectors you get the specular effect and that's why in the code you you often calculate what is referred to as the health vector so now that we have that code into another custom function note that you see here we bring all of the inputs in and most of the inputs are mostly you see specular smoothness color they're like settings for the specular and then some other inputs are necessary data that is used to calculate the specular like the direction of the light the view direction and the normal vector of the surface and we get out a vector three which is the color and intensity of our specular the settings so now our model looks like this and as you can see I still have here the shadows the dot product that gives me the lighting multiply them together then from here I bring the color to the specular some settings and you see that here I don't multiply I add because multiplying usually works as a mask it excludes things while here the specular has to be on top so whatever the lighting is there's gonna be a point of light from the shining if there's if the surface is shiny so I want to add these values on top not multiply otherwise they will cancel each other out whatever there's no specular it will be it will kill the lighting yeah specular is now this and of course you can transform that into a sub graph as well if you want so now it looks like this so you can see here the point the bright point so the reason why I said don't take photos is because actually most of this code comes from a blog post that was published a month ago couple of months ago by my colleague Alex link man she made this blog post specifically on how to get lighting information and again even if you don't take a photo if you literally like Google like custom lighting shader graph unity blog you'll find it it's one of the latest ones and if you remember the image you're gonna spot straight away the point is after all these calculations there's still something more to do if you want like there's other things there's getting information from ambient lighting or GI that you can incorporate in your graph and you can then integrate additional lights in the scene because for now I'm only taking care about the I'm only taking care of the main directional light because for my shader that's fine in your game you might want additional lights so you will need to do a little bit more work in this custom HLSL step 2 now I have all the information I have a semi realistic shader even though it's simple Lambert but I have all the information I can start playing with it so this is the final graph I would say is neatly organized I know what you were thinking this guy's Italian you must love spaghetti but I do but not in my graph so as you can see there's a way to be order than an organized even shader graph so let's analyze the graph piece by piece right so lighting and shadows first thing I want to do is I want to take the lighting information from the Lambert model and obtain this effect that you see I'm pointing to here so I want a hard transition from light to shadows I want only two colors one transition and the other thing I want to do is I would never want to really reach full white or full black in my teens for that you could use a step operation and again this is a bit of a refresher for whoever is new to shading and shadow graph step works this way you have some range of colors a range of values I would say from zero to one and you step at a certain point which means you're creating a hard transition from zero to one so for example if you're stepping at 0.5 you get something like this you get at 0 75 you get more black and if you get your step at 0 25 you get more white and the cool thing with step is that if you reach the extremes 0 & 1 then you can really use this function as a mask because if you mask everything going to 1 it means everything is black then you multiply by that and you hide an effect and if you do the opposite you go to 0 you have full white you're basically revealing an effect fully so again using multiplication using step and then multiplying this by anything you can mask more or less that thing and I'll do I'll use it later the other option to do tune shading because there's several styles right is ramp ramp shading or gradient shading so the original values are above and the values that I want to get other ones below so basically what you do is you take a gradient and you map the same values to another gradient which can be I would call it soft or it could be hard hard transitions like the one you see below and if you visualize the gray the values on a graph that's what they look like right in in the original one you have continuous values that go from 0 to 1 and by mapping these to a ramp you get values that are stepped but not step just once but can be stepped multiple times and also this allows you to not go from not like all of the darkest values rather than having them start from zero you can start from like 0.1 or 0.2 and stop instead of white you stop at like 0.9 and that gives me a shading that's never like fully black or fully white easily and then I can adjust it later just by changing this gradient so that's exactly what I'm doing in my graph so this is the little part that controls the shading as you can see I have some light oops I went on the interface I have some light info that comes from the from the bottom from the custom function note irie map it because I had like -1 to 1 and now it feeds into this gradient the reason why these two gradients I'm going to explain later remember that I have my values remapped that zero is now here so fully black fully shadow means this color here it's not really really dark and then shadows stop here and then this is fully lit and then what I did the reason why I kept the minus one is because now I have an extra point of darkness on the real back of every object it's stupid is just stylistic it doesn't make sense but you know when you look at an object completely from the dark side you see an X and extra bit of shadow which you could call ambient occlusion if you want I don't know up to you but I thought it was nice it gives a little bit more depth to the to the model and again you see I brought it to the very end because I really just wanted a little spot so I removed the values again I Drive them through the gradient and then as you do this kind of stuff another small tip is when you work with gradients that are really hard hard steps sometimes you have unfortunate situations let's say if you have a light that's shining on a very on an angle that's like 90 degrees it might happen that when the light moves suddenly this side is shadowed and then it moves a little bit and sudden is completely lit and that's not a super nice effect because you see these flashes flashes on the sides of of cue like objects that are not really round so rather than working with this kind of gradient what I did was cheat and I'm using a gradient that's not really fixed so it's not like hard steps but he's actually a blend but then I put the step gaps really really close so what happens is that on a cube if light rotates I will see the side rather than flashing to a different color it will just gradually go to the other color it's just to eliminate those little glitches if you want the other thing is be careful with your textures because sometimes especially when you use assets that come from somewhere else maybe they come from the asset store maybe they come from a previous project the textures were not meant to be for a for a for a toon shader so the texture on the left which is an immanent occlusion contains some noise and that's fine you don't really notice it with your naked eye when you're using it just as it is but when you step it that noise translates in like little dots everywhere on your model so one suggestion is like you need to pre-process or better like create your textures on on you know with the purpose of the tone shading so again if you are taking assets from somewhere else it might make sense to quickly jump into Photoshop and tweak these textures to make them better for your pipeline of tone shading and that will you know bring your you see here on the left there's a little bit of noise here and there which is really really noticeable on the right when I step the second texture even though I have some borders that are a little bit broken up when you zoom out you don't really see them so it looks it looks cleaner step two or second parts of the shading is the painted specular so what they do in Zelda is to have these strokes how did I call them painted as if painted with a brush right so as if you were like painting on the specular but with a brush with like very thick fibers other materials on the other hand like hair or other types of materials don't have that effect and this is just like a blob of color so the way to create this is actually quite simple you just need a texture that's repeating you can also use some kind of procedural generation for this texture and create some bars and duplicate them directly into shader graph I don't think it's worth it like it's a lot of nodes for what it can be like a super smooth texture and then you can paint that in Photoshop instead like like I did here and that gives you a little bit of random variation you can add some a little bit of different spacing which is nicer in the end result as long as it tiles right so you tile it several times I have a rotation parameter to control if I want to orient them differently and I duplicate it and then what you do is you take the original specular you step it so you break at some point and you say this is white and the rest is black and you multiply that by your texture which is being just like projected on the model and you obtain the painted specular in reality what I did in the final in the final graph was to rather than stepping the specular before I first I multiply them and then I step it because that gives me some software edges where the paint dubs finished so rather than a stroke being like cut you get a stroke that has like a rounded end if you step it after you multiply I'll show you the graph later by the way don't worry another point important part of that turn shader which is not really evident the first time you see it is what I call the backlight halo so the idea is like as you're looking at the character from the other side and the light is shining into your eyes basically you're looking at the dark side of the character that the character is not completely dark apart from the fact that is never black completely black but also it has this back light halo is as like like a contour that's lighting the the sides of the model and I think it's really interesting because it gives you an appreciation of the color even if you're actually looking at it from the light from the other side so when the point of view is completely opposite of the light source the contours are lit and that's super simple to do I started from a friend L effect which is this note here for nail effect is and know that automatically gives you like glow like a halo on the contours of the of the of the model independent of whatever you're looking at it from and then what I did is I found another dot product coming from the direction of the light and the direction of the camera I use the dot product I do some math on it random maths and I bring it into a step and then basically I'm stepping the final effect according to how much I'm looking against the light or not so as you rotate the camera you get stop it and this is the effect right so as I rotate the camera towards the light you see these contours coming in and if you again you bring it to the light to the same direction of the light the contours go away but then they're not needed because I'm on the light side right so it's a it's an interesting effect another part of the pipeline is what I call the side shine and it's kind of similar it's a shine that appear on the just on the side and basically it's the side that is illuminated by the light but it's not like a specular because you never see it in the center of the of the shape you always see it on the side literally on the side and again it helps read the silhouette and it creates a nice contrast and now finally sometimes this shine becomes white so it's the brightest point in the in the lighting model brush shine is really really similar I have two things that are controlling how much bright shine I have one as you can see is the dot product of the view direction and one in the light and one is the dot product of the normal and the light so both together make it so that you only see the shine when you're looking at the character a little bit to the side but not completely from the other direction and never from the front and both are added on top of each other so means the meaning that like they provide a contribution to this value right when you add them it means that two effects are working together to bring a number to a certain point so they're both providing a little contribution to how much you see this stepping sorry how much you see this fernell effect and that's the effect so the light is coming from the right and the more I rotate to the side the more I see this effect but I never see it in the center of the of the object so you know it's not really a specular so to recap and give you like a like an overview of the whole graph in simple terms I have the base lighting coming from my custom node custom hlsl node and I extract parts of it depending on what I need to do so one part is the light and shadow information and then I run that through a ramp and I get something like this one part is the specular as I said I use it as a mask so I multiply by the specular a certain texture and then I get this specular here this stylized specular and then on the side I start calculating other effects which are light direction dot view direction and I get the backlight rim and then light direction and normal and I get the side shine and then I start adding them so my does something same there was sorry some sort of pipeline if you want and I keep adding to the to the final effect and one thing I want to say is that the backlight rainworks slightly different from the side shine because the size shine goes on top of whatever is before but the backlight rim it kind of like eats the shadows so as I rotate the model and I look at it from the other side whatever was shadowed is gonna be canceled it's like erasing the shadows with an eraser along the contours so I have to treat them differently these two go together lights and shadows backlight Reem I add them and I get my final lighting right and only then I start adding the the specular on top and the side shine on top and I get my final model final graph looks like this when you simplify it you see that there's these macro blocks and I think oh yeah this is the final result so you see motion is really interesting you rotate around you're looking against the light and you get this nice side shine and I got close here to show you how the rims are lit that's pretty much it but I want to show you in the editor so this is the specular right you see that it depends on the direction where I'm looking at the model from you have this side shine because the light is coming from the right and a bit a little bit from the back but the side shine never gets the center right it's not a real specular and then you have to zoom on this correct center you have again sighs shine set shine set shine and then from the back you see you get the size shine only on the side where the light is coming from so now it's more to this side and now it's more to this side but then the other effect is if I start really looking against the light then you see this effect here which is revealing a lead side basically which shouldn't be there this part shouldn't be lit but I'll light it artificially so that's what I'm saying when I say that I I erase the shadows I'm eating into them with the halo right you see it all here around the the sleeve and as I move it goes away because now I'm looking at the lit side so I'm fine like I can appreciate the colors of this model but if I look at it from the box I don't wanna see black but I want to see some other color it makes it more interesting and this part here this here and this here are the -1 values you know the ones that I said they're kind of like my ambient occlusion so if I go to the the llama which is here it has it on the on the underside the effect is a bit strong here and of course into my shaders I built a lot of control variables so I can control the backlight amount and tweak it per model right so I always have these multipliers sometimes their multipliers sometimes they added on top and they allow me to tweak the effects and the masks that I'm creating all the different components of this shader the other thing I want to point out is like in Zelda I thought it was nice to have two versions of this shader one for the characters and one for the backgrounds and so that's why you saw before the two gradients because I'm actually using two gradients depending if an object is a character or is a background so for example all of these characters and the barrel and the bottle are interactable right so I'm using a certain type of gradient and the backgrounds are using a different one and that makes them stand out a little bit more you could accentuate this more or less but basically this gives the player or you know whatever if you're making a movie the viewer an appreciation of what's foreground and what's background so if I were to turn this character into background and I can do it through a boolean you see how the shading changes it's a bit more flat is a bit more dull it's not bad but it's it's totally different and it uses the shine so whenever I see you know especially again in a game something that's shining like this I know that I can interact with it it's maybe an object I can pick up or it's an enemy and you can spot it at a distance which obviously Zelda does very well because Zelda has like huge scenery so it's nice to be able to spot something at a long distance and say oh there's something there let's go and investigate right so it has two different shaders for interactable objects and not interactable I do this branching directly into the shader by using I mention them in my talk yesterday the shader keywords so if I open the shader finally you'll get to see it my spaghetti masterpiece it looks like this lighting model is here my starting point of course there's something before because we add normal maps to the lighting model to actually calculate the final lighting and once I have this information as you can see here I can bring out brightness diffuse and specular separately and bring them to different branches of the shader so the specular goes down sorry let's start from the brightness brightness goes to the gradient department two different gradients there are sampled according to this to the shader keyword so if I open the blackboard you'll see it here at the bottom it's a keyword called hard shading you see and if I define it I can then use it into the graph as a branching point and I'm doing it here so this means that whenever I have an object I have a checkbox here at the bottom hard shading and I can seamlessly switch between the two branches and what unity does when I build this game is it builds two versions of the shader so depending on what's the value of the check box it uses one or the other so it avoids some calculations on the branch that that one specific object is not using so again two different gradients and as you can see one is softer and one is more harder and that's like obviously gameplay and background so again and then I do some stuff what else here you have the backlight here you have the bright shine the side shine obviously grouped into groups so I can move them nicely around the side shine is also controlled by the keyword that I told you before so I can disable both things at once you see if it's on side shine if it's off just a zero just lack color which gets added but adding black mix does nothing and then specular here on the bottom specular here is a bit more complex than what I told you because after calculating the Dubs I I basically run everything through a maximum node because I want to use the textures to control which areas have like a painted specular and which has do not so there's a bit more complicated stuff there but it's really not worth explaining it's just simple math and then the let's see that's pretty much it and then here and there you will see like some texture inputs because obviously this shader has to support albedo he has to support normal map it has a support occlusion so it's mostly a matter of reading them and multiplying them by a color and then multiplying them by the the original lighting another little tip that I can give you again no spaghetti Cole is using this preview node as kinda like answer as a corner right because the preview node doesn't do anything it just takes a value and passes it forward so it's easy to use it's good to use if you want to rather than having like an oblique line that goes this way you can just use it to reorganize and run a line like in a different part of the shader if you wanna you can do that that's pretty much it so yeah that's much everything obviously the shader has a lot of settings to control everything from the material editor the final thing I wanted to mention is let me go to the other scene is better easier tests in creating these shaders and these materials because some materials we have a bunch of settings and maybe you'll find like the optimal settings for something you want to keep them and you want to replicate that for for example for the same physical material if you have wood in your game in your game in multiple places you I get the same settings so one useful thing which is I think it goes under the radar a lot is presets so in the material editor you can click on this icon here and that allows you to save a preset or to select a new one so by doing that you create a scriptable object that contains all of the settings for your material and then you can quickly switch it to take an object take a material and turn it into different settings so for example I can say that this one is now hard shading and green or soft shading and blue and you can create as many presets as you want so you can create really create like a workflow and give a bunch of presets to artists and see like for all the wooden objects start from this preset and then you add the texture on top for all the metal objects starts from this preset preset that's pretty much it if you're interested to learn more in shader graph there's a lot of resources online of course and then we have some resources on our learn website and then we have learn premium which is our paid section of the learn website if you are on unity placer pro you should have learned premium already if you're not you can use this code to get three free months again there's a lot of tutorials about it this is all from me do you have questions on this subject and by the way if you want to download the shader that's the URL so feel free to use it to modify it in your projects but yeah I have we have four minutes for questions and there's two microphones one there and one there if you do me the favor of going to the microphone okay give me the question and I'll repeat it thank you that's a good question I don't know I don't know I I think it does I think there should be a way to do it there's different keywords that behave in a different way but yeah there should be an opportunity you have a question okay yeah if you have a question if you can go to the microphone it would be great so the question is how does it work with keywords and optimization does it remove the branches yes far as I know it compiles different versions of the shaders it's basically what you would do with keywords in a regular HLSL shader so it compiles different versions and then it uses the the necessary one according to the settings now as you said like whether you can switch that a run time I think so because it makes sense like you would just then just use the other shader but yeah it's it's that is the gain in performance because otherwise the other option is to just use a boolean and with a boolean what you're doing is you're always evaluating both sides of the branch in your shader and then just taking one of the results just discarding the other one which is fine if the branch is very short like if you're doing something very simple like a few additions and multiplications but if your shader is doing a lot especially like texture reading it's not the best hello one question I know that for say the graph the main purpose is making people who really don't know how to code prefer not to code if that sounds to create cool effects so my main that is why there are so many function like getting the main light that you are relying to use like a custom node I mean it's cool because I draw there was a lot of thing I was thinking hey I want to keep calling so they the cruise terminal function is super cool for me by the same time like getting the mail light up for example the lighter models it will be very nice if you have like already a note for that maybe oh it's in the roadmap that's my question is there an I see I see and I as soon as you started I knew it was going and I agree I mean that's as you say like shader graph is meant for artists you could say you could argue technical artists but why not have a node that does start already so I think the reason is I think there should be one for simple simple things like getting a main light or for example universal rendering pipeline because in universally in rendering pipeline you probably just have one main directional light so I think there should be that and I think they're looking into adding that I think also it wasn't a priority in the sense that like they would they wanted to get our shader graph first in in a stable way and finalize all the api's and all the way to do things for example the custom function node just became a node very recently before it was a set of c-sharp api's so I think now in the near future this kind of stuff will come for very very common uses the realities then apart from those use common cases then each case is different and it starts becoming very tough to provide for example the way I do shading right like the getting in the main light is fine it could be a node if you write the Lombard shading is already like something like somebody wants a lumber shading somebody wants a slightly different one so if you make a node then you're making something that not necessarily everybody is using in the same way but yeah I agree some some things like getting main light or gaining additional light should be there okay think Thanks I want to tag on the question like will you make a toon shader further down the line like in other DCC packages Sariah what will there be a toon shader available like a sub graph or something for the downline like you have in blender Maya yeah cinema 4d whatever not sure not sure for the same reason I think because how many ramps how many you know it's like do you want a ramp or a stepped if you look at other programs they have it and you can choose different model sorry Gramps in other this is a packages yet they have them I think it's I see very good for non coders I know but I think for us it's always a matter of striking the balance between what we provide and the way people want things and then whenever we provide something official then we have to maintain maintain it and you know make sure it works in all possible variations and combinations I just think if unit is gonna go down the road and complete with all the digits packages I think it to in shader should be there okay back to the time you look super cool and you could do it no no I know I know and you know what I'm going to say is you're right far from like it's not a lot of work to make but I think the reasoning there is always the same it's always like what kind of to shader you know like what effects do you want on it and inevitably you always find a use case where somebody wants to remove some parts because they're heating hard on their performance which in a modeling package is less important but in games is super critical and then that you say that doesn't work anymore for a few cases ok thank you that's power that's always the the answer in these cases okay yeah thanks thanks for the question okay no more questions we're done thank you [Applause] [Music]
Info
Channel: Unity
Views: 45,457
Rating: undefined out of 5
Keywords: Unity3d, Unity, Unity Technologies, Games, Game Development, Game Dev, Game Engine, computer graphics
Id: DOLE4nrK97g
Channel Id: undefined
Length: 48min 16sec (2896 seconds)
Published: Mon Sep 30 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.