-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate creating custom shader code in unreal #287
Comments
Here"s another relevant link I came across about custom compute shaders in unreal: https://medium.com/realities-io/using-compute-shaders-in-unreal-engine-4-f64bac65a907 |
After a bunch of research, it"s definitely possible to have custom HLSL pixel or compute shaders in Unreal, but it takes quite a bit of setup. The general feeling I got is that it"s not really worth using full custom shaders over the Material Editor unless we are doing something very specific that can"t be done at all in the Material Editor. So, what exactly are we looking for with custom shaders? In particular, where is the Material Editor failing us, and are there alternative workarounds? The other drawback of using custom shaders is that it will make it harder for users to edit materials on their own. Using the material graph makes our materials accessible, and any parts that are using custom shader code will be less accessible. It may be worthwhile to utilize custom shader snippets for some parts of our materials, but in my opinion we shouldn"t switch over to an entirely custom shader. Now, I also found this - https://isaratech.com/ue4-programmatically-create-a-new-material-and-inner-nodes/ It"s a tutorial on creating material graphs from C++ code. It might help us if we do need to automatically create shader variants. Here"s some other helpful material that I found: And here"s a tutorial on using custom shader files in Material Editor materials - https://biq.medium.com/configuring-unreal-engine-for-custom-shader-development-biq-cf79f72e7137 This is also an interesting read about tips and tricks, overlaps a little with the one above - https://forums.unrealengine.com/t/extending-custom-hlsl-custom-expressions/88820/13 |
Is there any way to compile custom shaders (or materials for that matter) at runtime? Or can that only be done in the editor? |
Here"s what I found on this - https://twitter.com/AyLaylad/status/849371777734254592 Not a lot of information, but this is a person who seems to have managed to do it. May be worth looking in to. |
After the various updates to tileset materials, is this still desirable? Or should we clsoe this? |
@argallegos The compute shaders might still be useful. But I think our current material layers system is sufficient for custom styling of a tileset, via metadata or raster overlays, which were the primary motivations initially of custom shaders. In CesiumJS there was a 3D Tiles styling language, that would allow metadata styling and generate a shader at runtime to enable the styling (that was my understanding at least). In our plugin though, that styling language would be significantly less accessible than the material system we have now. I think it"s fine that users create tileset materials at editor-time, it allows them to inspect the metadata and set up specific materials corresponding to specific metadata. Custom shaders were also intended to remove the need for the gltf uber-material-layer we have right now. But I think our default material isn"t horrible, and users can always edit out textures and logic they don"t need (but maybe we should make that easier by making it more modular). I"ll close this for now. Compute shaders are mostly a separate topic, but I think I"m confident Unreal compute shaders are quite straight forward, so we can just figure it out if we ever need to use them. No need to open an issue for that. |
I haven"t tried it out yet, but it looks like we can create a custom shader code in unreal after all:
https://medium.com/@lordned/unreal-engine-4-rendering-part-2-shaders-and-vertex-data-80317e1ae5f3
Unreal may use its own custom shader language that will be translated to hlsl or glsl or metal.
Edit: it may actually use HLSL and translated it to other shader languages: https://docs.unrealengine.com/en-US/ProgrammingAndScripting/Rendering/ShaderDevelopment/HLSLCrossCompiler/index.html
The text was updated successfully, but these errors were encountered: