You can also check this thread where the OP has implemented his own shading model, he might give you more information where to look at if you really think it is a good idea go through all the trouble:
Thanks!
well, I need to create a vertex shader and a pixel shader. The pixel shader draws circles, but I’ll have to draw thousands of circles faking shadows on them, but they are billboards generated by the vertex shader. Then the pixel shader draws those balls in them. It’s not just a regular material. I guess I’ll have to write my own hlsl shaders, using vertex factories and all that. I guess you can’t generate vertex shaders using the editor. This has to be extremely optimized, not using custom nodes, which are not optimized … but I don’t think I can do it using the material editor at all.
If I had a vertex shader running… could I then modify it using the pixel shader done in the materials editor?
It’s just that It’s the first time I work with game engines as big as this. Sorry for not being very clear!
Agh. Unity it’s just “create shader”, write your code, and it works.
It comes to my mind that maybe your solution is too attached on the way Unity works regarding shaders, it is good that you see how is can be done in Unity, but the concept is compromissed because it is biased. When the concept is free of the implementation way if doing, it is clear. I still read your text and Im not really sure what the effect is, because you are telling the way you would implement it in Unity (which I never used). Try to describe what the idea behind the effect is, so people can translate the idea into the implementation, otherwise is greek for anyone reading.
Custom nodes are just plain HLSL they are optimized as any other shader code you write. Custom code do not have special material node optimizations that are related precalculating uniform math expressions using constants or per draw constants. This is where material graph can be faster than hlsl code but it’s not very big portion usually. Making shadow blobs with material editor sounds just fine. Just use WPO to generate billboards and you are all set.
Thanks to both!
It’s as simple as:
- Send a thousands of positions in space (collapsed quads for billboards). It’s all sent at once.
- Vertex shader modifies them to look at the camera given a size.
- Pixel shader draws something on them
I can’t create vertex shaders on custom nodes or the material editor, right?
Just that
Thanks!
You can try instanced static mesh. It’s not as performant(at vertex shader utilization) but given that you have only thousands of them there is no performance problem even for mobile. It’s fillrate limited anyways.
Answering myself. YES, you can create vertex shaders in the material editor, and it’s mainly through the World Position Offset and using the UV coordinates to think about the position of the vertices in general. Is not a very general approach, but you can actually change positions there.
So to do what I want :
- Create a vertex factory to send all the collapsed quads to the gpu (a good example of this is Cable Component, and others)
- Create a material assigned to the mesh that modifies the vertices to do the same as the Math Hall map in the Content Examples , where you can see an example of two ways of doing billboards with the material editor.
nice! and not very nice…
Found this link saved in my browser (between thousands) and it is RCaloca’s blog (Epic’s employee): https://rcaloca.blogspot.com.br/2017…rs-to-ue4.html
Usually I exchange info on Vulkan issues with him.
You might want to take a look there on each engine release because some API changes are 1st seen there. Also, on every new engine release, Epic’s own plugins for the composite (lens distortion plugin) are a reference on API changes aswel.
Hi i want to modify the Dbuffer decal shader to enable the metallic option. Where do i start ? Do i need the full source from github? And how exactly are the files for Dbuffer decals called.
To modify an existent shading model you will need the source code from github, do the changes, and you will have a customized version for you. If you are used to git, you will be able to track your own changes and at each engine new version you can see whats the difference and apply your changes to the new version in a blink of an eye.
You will need to search the code, but it is well organized and it will not be a nightmare, just a matter to get used to th structure and then it will be mostly like the same for each model. It will become familiar to you after some study on the code, how to implement your own models, which might be better than changing an existing one to fit a purpose if someday you might end needing the old one.
Thanks a lot !