Acegikmo, can you speak to how well these shaders might run on mobile? Are there any mobile-specific tweaks that should be made, or that could even be built into the tool?
I know some general guidelines can help, like avoiding branching logic, refraction, extra effects like that... but is there any stock code your tool generates that might not make the shader run well on mobile hardware?
Acegikmo, can you speak to how well these shaders might run on mobile? Are there any mobile-specific tweaks that should be made, or that could even be built into the tool?
I know some general guidelines can help, like avoiding branching logic, refraction, extra effects like that... but is there any stock code your tool generates that might not make the shader run well on mobile hardware?
SF primarily manipulates your shader in the fragment shader rather than the vertex shader, which, can get expensive on mobile.
Currently, SF doesn't support vertex lighting, but it is a planned feature
Further down the line I'd love to add a bunch of features to aid the optimization process, but it will most likely have to wait until post release.
But other than that - Use Lambert or Unlit, use interpolated normals instead of normalized normals, disable multiple lights, disable shadows on the object, and so on!
Been using this today for the first time, great stuff! However I just spent the last 2 hours making a test shader, saved it, exited, and came back to find all the node connector pieces have disappeared. But all the previous nodes left intact and where they were before quitting Unity. Did I do something wrong? Or is this a bug that needs fixing o.O
It would suck to re-connect all my nodes back together after quitting Unity every time haha...
image proof, all these were connected before, then after I re-opened the shader later:
Edit: I am also using the free version of Unity, if that makes any difference
no errors from what I can see, although you are correct the shader still retains it's info. It's just that this might become a problem if I wanted to make quick changes, and had to re-connect everything to do it. Is there any way around this? :S
Of course it's an issue
You should definitely be getting errors in the console if something like that happens.
I'm not sure what happens, so I don't know if there is a way around it at the moment. Does it happen when you open any of the example shaders too?
I've started working on documenting all the nodes on what will become the Shader Forge website! It's very basic at the moment, but all the nodes are there, and the search box should work properly
SF is nearing beta! Which means features will soon stop rolling in, and focus will be put on workflow, polish and bugfixing.
Are there any specific bugs or features would would consider the most important for now?
I will keep working on SF post-release, so some things, like deferred rendering, will be in a future update
Is there a way to control the speed of a Panner with properties?
I tried doing something like this, but it scales the UVs as well, I want to just control the speed.
The U and V settings on the panner controls the speed, but if you want an exposed property for each dimension, you'll need to do a "manual" panning node setup
I put together a gradient mapped shader, but it's giving me some issues. Anyone know why it would say I am using 4 textures when I only have 3 texture nodes? Does one of the nodes I'm using create a texture in the background? I figured if I accidentally dropped in another Texture 2D node I'd see it in the inspector but I don't see one and I can't find any in the node view when I pan around.
Sometimes when I save and exit a scene it comes up with an alert message saying "Cleaning up leaked objects in scene since no game object, component or manager is referencing them. Texture2D has been leaked 10 times." (Or how ever many times it has been used).
SF is nearing beta! Which means features will soon stop rolling in, and focus will be put on workflow, polish and bugfixing.
Are there any specific bugs or features would would consider the most important for now?
I will keep working on SF post-release, so some things, like deferred rendering, will be in a future update
Excellent news Ace. Personally I'd love to see tutorials/manual/examples more than anything at this point
I put together a gradient mapped shader, but it's giving me some issues. Anyone know why it would say I am using 4 textures when I only have 3 texture nodes? Does one of the nodes I'm using create a texture in the background? I figured if I accidentally dropped in another Texture 2D node I'd see it in the inspector but I don't see one and I can't find any in the node view when I pan around.
Sometimes when I save and exit a scene it comes up with an alert message saying "Cleaning up leaked objects in scene since no game object, component or manager is referencing them. Texture2D has been leaked 10 times." (Or how ever many times it has been used).
not sure what's causing the specific issue of more textures being used than you're actually inputting. you could optimise though... use a constant of 0 instead of a texture for input B of your lerp, and move the alpha into the alpha of input A. since the paw prints (it's what they look like) are a solid colour anyway, it makes more sense to do it that way.
Thanks for the tip Almight_gir, but I'm don't think it will work in this situation. I've got 17 overlay textures that I've built to mess around with this setup, some are solid black or white (pink pig on bottom left) while others have a mix between the two (blue/purple pig on bottom right adds back a dark color under the white spots).
Admittedly I could scale down all the spot overlay textures and put them in the alpha channel . But that adds more steps to the shader. I suspect it still saves on processing power, but I don't know the conversion between shader steps and textures. Considering that the texture size is pretty small (256) it probably doesn't save me a whole lot of processing power in the long haul anyway.
It'd be a good exercise though, if I gave up multicolored overlays.
Acegikmo, I've been beasting making awesome materials thanks to this. Any chance of implementing an outline shader for toon style edges? Is there a way to do this with some vert offset trickery?
edit: Also, I'd like to combo the awesomeness of Shaderforge with some other FX I'm using. Is there any way to add properties INSIDE Shaderforge (properties, tags, or extra lines)?
Example: We're using Glow 11 right now. It requires us to add some properties, tags, and a line to the shader, listed here under 4.: http://i-gamedev.com/glow11/manual/
What I have to do now is compile my shader, open the source and start adding stuff. Whenever I go back to change the shader in Shaderforge these changes are thrown out on re-compile and I have to add this stuff again manually. This may be impossible and I understand if it is!
Outline is a planned feature I will add two new connectors to the main node - one called outline width, and another called outline color.
As for that effect - I guess you would need a way of adding custom tags to your SubShader. It's quite an advanced one, but I suppose it might be done down the line. Could you post the custom SubShader tags as a request on UserEcho, to make sure I'll remember it?
Acegikmo, I've been beasting making awesome materials thanks to this. Any chance of implementing an outline shader for toon style edges? Is there a way to do this with some vert offset trickery?
edit: Also, I'd like to combo the awesomeness of Shaderforge with some other FX I'm using. Is there any way to add properties INSIDE Shaderforge (properties, tags, or extra lines)?
Example: We're using Glow 11 right now. It requires us to add some properties, tags, and a line to the shader, listed here under 4.: http://i-gamedev.com/glow11/manual/
What I have to do now is compile my shader, open the source and start adding stuff. Whenever I go back to change the shader in Shaderforge these changes are thrown out on re-compile and I have to add this stuff again manually. This may be impossible and I understand if it is!
Got it, will do! Can't wait for the toon shading, glad it's on the list.
Also, need some clarification with the Time node. I made a UV panner with the Time node as pictured here:
This runs fine in the SF editor, with X and Y speed as the two Appended values. However, when I CLOSE the SF editor and try running it in the game, the panner doesn't work and is stuck in one place. If I open the SF editor in the background, the panner -does- work in game, making me wonder what I have to do to activate the Time node.
(For the time being, I replaced T with a slider and animate the panner with a script.)
The Time issue is a tricky one, but it will be fixed.
The reason for this is simply because the built-in variable _Time doesn't run in the editor, only in play mode.
Essentially, if I used _Time, which would work in-game, it would only animate after you've pressed play, but remain static in SF.
I added a property called _TimeEditor, which SF is constantly updating while it's open, so you can see your shader animate, but it doesn't update in-game without a script to do it.
The tricky part is that there's no perfect solution to this, that I've found yet. It's either:
A: Compile two shaders, one with _Time, used in-game, and one with _TimeEditor, used in SF. The issue here is that compiling will take twice as long, and it would also risk drifting SF away from being 100% WYSIWYG.
B: Add the two different time types, and stop pushing values to _TimeEditor when the game is running. This is the most elegant solution, I think, but the obvious issue with this is that your shader will need to do an add operation when you use time, which isn't needed in builds.
I'm going to go for B in 0.14, and we'll see how it goes.
I imagine there might be a "Finalize all shaders" button or similar in the end, which readies them all for a build.
Hey Acegikmo, I was playing around with the matcap, but since it's creating a second pass on the shader it breaks the batching in Unity, is there a fix or a way to create a matcap without doing a second pass?
Matcap shaders in particular doesn't create more passes that most other shaders. Pretty much all shaders dealing with lighting are multi-pass shaders, unless it's lightmapped or using the forward, "4 lights in one pass" thing, which I haven't looked into yet.
However, static batching should be fine, just make sure you use the same material on all, and mark them as static.
Alpha 0.14 is soon ready - I'll add the next batch of testers as soon as it's out
There are quite a bunch of usability and new features in 0.14, a changelog will be up soon.
The beta is getting closer and closer!
Replies
Keep it up!
(ps. when are we gonna have the fresnel? :P )
Can't wait to play with that "if" node.
About 30 minutes
New things:
I know some general guidelines can help, like avoiding branching logic, refraction, extra effects like that... but is there any stock code your tool generates that might not make the shader run well on mobile hardware?
SF primarily manipulates your shader in the fragment shader rather than the vertex shader, which, can get expensive on mobile.
Currently, SF doesn't support vertex lighting, but it is a planned feature
Further down the line I'd love to add a bunch of features to aid the optimization process, but it will most likely have to wait until post release.
But other than that - Use Lambert or Unlit, use interpolated normals instead of normalized normals, disable multiple lights, disable shadows on the object, and so on!
http://udn.epicgames.com/Three/MaterialsCompendium.html
I also found some mesh offset examples which is cool as well and might be helpful for you Acegikmo.
http://udn.epicgames.com/Three/WorldPositionOffset.html
http://udn.epicgames.com/Three/MaterialsCompendium.html
I also found some mesh offset examples which is cool as well and might be helpful for you Acegikmo.
http://udn.epicgames.com/Three/WorldPositionOffset.html
It would suck to re-connect all my nodes back together after quitting Unity every time haha...
image proof, all these were connected before, then after I re-opened the shader later:
Edit: I am also using the free version of Unity, if that makes any difference
You should definitely be getting errors in the console if something like that happens.
I'm not sure what happens, so I don't know if there is a way around it at the moment. Does it happen when you open any of the example shaders too?
http://acegikmo.com/shaderforge/nodes/
I tried doing something like this, but it scales the UVs as well, I want to just control the speed.
SF is nearing beta! Which means features will soon stop rolling in, and focus will be put on workflow, polish and bugfixing.
Are there any specific bugs or features would would consider the most important for now?
I will keep working on SF post-release, so some things, like deferred rendering, will be in a future update
The U and V settings on the panner controls the speed, but if you want an exposed property for each dimension, you'll need to do a "manual" panning node setup
Sometimes when I save and exit a scene it comes up with an alert message saying "Cleaning up leaked objects in scene since no game object, component or manager is referencing them. Texture2D has been leaked 10 times." (Or how ever many times it has been used).
Excellent news Ace. Personally I'd love to see tutorials/manual/examples more than anything at this point
not sure what's causing the specific issue of more textures being used than you're actually inputting. you could optimise though... use a constant of 0 instead of a texture for input B of your lerp, and move the alpha into the alpha of input A. since the paw prints (it's what they look like) are a solid colour anyway, it makes more sense to do it that way.
then you're only using 2 textures.
Thanks for the tip Almight_gir, but I'm don't think it will work in this situation. I've got 17 overlay textures that I've built to mess around with this setup, some are solid black or white (pink pig on bottom left) while others have a mix between the two (blue/purple pig on bottom right adds back a dark color under the white spots).
Admittedly I could scale down all the spot overlay textures and put them in the alpha channel . But that adds more steps to the shader. I suspect it still saves on processing power, but I don't know the conversion between shader steps and textures. Considering that the texture size is pretty small (256) it probably doesn't save me a whole lot of processing power in the long haul anyway.
It'd be a good exercise though, if I gave up multicolored overlays.
I'll see if I can get it fixed for Alpha 0.14!
The Texture2D leakage is a known issue, just haven't bothered with it yet as it isn't critical. I suspect that will be sorted during the beta phase.
Also, I apologize for the delays, I've picked up a part-time freelance job now, so things are progressing a bit slow, sorry about that.
edit: Also, I'd like to combo the awesomeness of Shaderforge with some other FX I'm using. Is there any way to add properties INSIDE Shaderforge (properties, tags, or extra lines)?
Example: We're using Glow 11 right now. It requires us to add some properties, tags, and a line to the shader, listed here under 4.:
http://i-gamedev.com/glow11/manual/
What I have to do now is compile my shader, open the source and start adding stuff. Whenever I go back to change the shader in Shaderforge these changes are thrown out on re-compile and I have to add this stuff again manually. This may be impossible and I understand if it is!
As for that effect - I guess you would need a way of adding custom tags to your SubShader. It's quite an advanced one, but I suppose it might be done down the line. Could you post the custom SubShader tags as a request on UserEcho, to make sure I'll remember it?
Got it, will do! Can't wait for the toon shading, glad it's on the list.
Also, need some clarification with the Time node. I made a UV panner with the Time node as pictured here:
This runs fine in the SF editor, with X and Y speed as the two Appended values. However, when I CLOSE the SF editor and try running it in the game, the panner doesn't work and is stuck in one place. If I open the SF editor in the background, the panner -does- work in game, making me wonder what I have to do to activate the Time node.
(For the time being, I replaced T with a slider and animate the panner with a script.)
The reason for this is simply because the built-in variable _Time doesn't run in the editor, only in play mode.
Essentially, if I used _Time, which would work in-game, it would only animate after you've pressed play, but remain static in SF.
I added a property called _TimeEditor, which SF is constantly updating while it's open, so you can see your shader animate, but it doesn't update in-game without a script to do it.
The tricky part is that there's no perfect solution to this, that I've found yet. It's either:
A: Compile two shaders, one with _Time, used in-game, and one with _TimeEditor, used in SF. The issue here is that compiling will take twice as long, and it would also risk drifting SF away from being 100% WYSIWYG.
B: Add the two different time types, and stop pushing values to _TimeEditor when the game is running. This is the most elegant solution, I think, but the obvious issue with this is that your shader will need to do an add operation when you use time, which isn't needed in builds.
I'm going to go for B in 0.14, and we'll see how it goes.
I imagine there might be a "Finalize all shaders" button or similar in the end, which readies them all for a build.
However, static batching should be fine, just make sure you use the same material on all, and mark them as static.
There are quite a bunch of usability and new features in 0.14, a changelog will be up soon.
The beta is getting closer and closer!
Here are some .gifs and a changelog image, as usual
Jesus Christ. You're a machine. Awesome stuff, dude.
Is there a way to tell in a double sided shader which side a current pixel is on?