Hi folks! Decided to redo my pbr shader from the ground up following a metallness workflow.
There will be two versions, one with all parameters textures separated, and one that uses each channel of a single texture.
Also simplified a lot of things, one of them is that you no longer need a checkbox to use a texture.
This way the shader is much simpler to operate:
Another thing that I've been working on... area lights!
And its possible to mix any type of light, as far as your hardware can handle:
There are some stabilty issues that I still need to figure out. For example when adding an area light that light will flick until you change its intensity or position or refresh the viewport.
Also, I wish I could light loop a shadow map inside a custom code
PCF and PCSS are 4x and 16x, respectivelly, slower than calculating them in a custom code. But its impossible to loop it for all lights, just light 0.
Still need to sort opacity and translucency, as soon as I fix those things I will star releasing the shader.
Thanks!
Replies
Can't wait to try it out.
The area light is made using a spot light because its the only light that has a rotate-able light view prj.
So I can create an area by offsetting its position left and right, up and down with a transposed light view prj.
None of the other lights rotate the projection on the z axis. As I control the bias inside the shader I differentiate normal spots from area spots by increasing its bias past its default value. Then the area with its cone angle and penumbra linked with a plane scale x/y. Then made a .mb from it, to add more are lights you only need to import this project, again and again.
Yes... I know, pretty ugly.
I noticed that shaderfx interprets maya's area light as a point light placed in that area light vertex 0 (its view prj also does not rotate).
I guess that there is no way to get that area light vertices position right?
Also, no way to loop the shadow map inside a custom code?
I tryed to loop it manually, but the light index is an "int value" and no way to create an array of it and increment it in a loop, just normal ints.
All light nodes loop normally inside a custom code (light direction, vector, etc). But shadow maps create a variable that is not found during compile, something like BBB_BBB_blablabla. If I manually assign it a light index it works normally, but only for that index.
Sorry for all the question bombardment, again,
Can you give a code example of the shadowmap issue?
I don't completely understand what is happening for you.
There shouldn't be anything generated that is not available during compile time, but I might be misunderstanding the issue.
We use shadowmap information directly also in for example the AutodeskUberShader.fx that you can load into the DX11ShaderNode.
Area lights:
For area lights, it might be that the Maya viewport api is not giving this information to shader plugins (like ShaderFX). I don't think I do anything specifically different for area lights in the code.
I query the Maya API for all the light information is has, such as direction, color, etc. Whatever the API gives me, I try to bind inside the shader.
It is possible the API doesn't provide this information for area lights.
(It is also possible I did something wrong, of course)
About the shadow map, I did a very simple custom code to show you what happens.
As you can see by the node preview, the custom code compiles normally (float3 shadMap = SFX_TEXTURE0.Sample(SFX_SAMPLER0, uv);), but as soon as you connect it to a light loop, it throws an error: undeclared identifier "_LightShadowMap".
And the area light:
As you can see, it emmits a light from one of the area light vertices, not the center, that makes me think that somehow maya API is giving you this vertex information and hoped it would be possible to query the rest, so I wouldnt need to fake it with a projection and do all those ugly things with a spot light.
Again, thanks a lot Kees!
Unfortunately its not possible to make screen space effects such as SSR, as we dont have access to the frame buffer in shaderfx. I really wish we did =(
Also not. ShadowMap is generated by maya and passed to shaderfx through the API. The resolution is locked to a max of 4096. We can do some smart filtering but thats all. Also it encompass the entire scene. So the larger the scene, larger is the area that the 4096 map needs to cover so you lose more and more shadow detail.
Game engines generates multiple shadowmaps to remedy this. Techniques like Cascaded Shadow Maps or Parallel-Split, (asked autodesk for it if you want you can vote for it here). It works, for example, by using 4 shadow maps, a 4096, a 2048, a 1024 and a 512, using them according to the camera distance and blending between them keeping objects close to the camera with a good ammount of shadow detail. There is also raytraced shadows which can be generated very quickly in modern graphics cards that has full detail on the entire scene (but needs to be blended with PCSS for soft shadows).
I plan to make plugins to maya API to generate these shadow maps and hopefully screen space effects. But thats very complex and I need to study it a lot. Also it needs to be done for each version of maya and that requires a lot of time, something I dont have So dont expect it very soon.
Having this kind of features on the viewport would be amazing, both for pre-viz, quick prototyping and asset testing without needing to resort to marmoset or exporting to a game engine and even production, which would be so very awesome, but its not autodesk priority, the best we can do is make some noise and let them know we want that (in the end, its not a complex thing for them to do).
I'm reaching out to almost everyone here .. I'm new to the site and I'm a CG animator looking to make a short film utilizing viewport 2.0 and the ShaderFx instead of going the full render path..it's a personal short film, and I'd love to keep the cost to a minimum... do you know of any site/service where I can buy/download ShaderFx shader libraries?
Thank you
Thank you
No, shaderFx is visual programming, much more powerful then mayas viewport.
You can create custom techniques and do lots of things that are impossible via hypershade. Things like custom shadow filtering, blending normals, blur maps, create your own procedurals and even raymarching, etc.
Also, hypershading in the viewport will quickly become slow as hell. Maya need to actually convert everything you do in hypershade to a realtime shader and as your graph increases (like 5 nodes) maya will bend to its knees, and every update will take forever.
I assume it's not easy / possible 'cause otherwise somebody would probably already do it XD
Is it possible to create realtime fish-eye camera distortion in realtime inside the viewport? Like PlayblastVR does? Would You be able to implement it and how much time/money would it cost ?:D
Link! Check out the seventh item, "Demo: Autodesk Maya in-Engine viewport".
Using shaderfx its the same problem as before, no framebuffer, no full screen effects.
So you would need to go the API route, and that is beyond me, for now at least.
Here is an update on the shader.
One of them is the following.
float3/4 (dx11Shader)
vec3/4 (glslShader)
Position for the four corners of an area light.
Is it possible to query this in shaderFx, maybe inside a custom code perhaps??
Thanks!
Had some time today at work and did a little update.
Tone mapping, fuzziness, blended normals and a bit of the toolbox:
Rock model from Megascans.
(
@shaderfx Thanks a lot for your time Kees! Can we hope for it to be added? What about that custom code shadow map error? Any ideas?
But here is another update.
It was a sad day here.
Due to the very short time to do it, I used this shader and made a viewport render with some minor tweaking in after effects.
HDRI by MAC MAVE
There are several advantages, the reflection blurring is much better. There is a large gain in performance and quality when compared to gaussian blurring the reflections in the pixel shader and a huge gain in quality with the same performance when using mip mapping alone.
The downside is having to either use Lys to do that, or manually doing it. (I recommend grabbing it, its an amazing piece of software!)
Awesome work!
Cheers, D
Any idea when you are releasing version 2.
good work...
My new toy is Eevee from new Blender 2.9 Imo the best real time rendering in a full scale 3d soft. True real-time reflections, screen space things, a convenient "uber" shader by default. Available nodes are a good compromise in between flexibility and simplicity. A lot more user friendly for an art person IMO.
I did not publish this as there is a specific call in the api that is not implemented in shaderfx regarding area lights.
The current temporary solution was to project onto the spot light, but it did not yeld correct positioning and was ineficient.
I`ve asked autodesk to add it to shaderfx as the workaround is not suited for a release.
Thanks a lot for all the love. I am trying to write a shader by hand but this will take a while and I can not set any dates, sorry for that.