-
Notifications
You must be signed in to change notification settings - Fork 14
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
Feature request:Add Water PBR material #17
Comments
Could you help me with creating a PBR water material @Ali-RS ? I made some changes to the I would like to create a new example showcasing how you can use a PBR material as a type for a block. I guess a water block is an ideal example for this. |
Do you mean you need help with the shader side? tbh, I have not worked with shaders so I am not sure if I can be of any help. |
I meant more in general. I haven’t worked with PBR materials before and have not yet looked into it. I don’t know what settings or lights you need to supply to make it look good. You have lights, lightprobes, environment maps, ... It’s still a bit unclear for me. The shader part to simulate waves, I can adapt later. |
Ah, yes, I can help with this stuff. You can read about PBR workflow in JME wiki: https://wiki.jmonkeyengine.org/jme3/advanced/pbr_part1.html# In short, the light probe is the thing that contains environment map data. You can use a pre-generated light probe or generate your own light probe. Then you can attach the light probe to the root node as you do for regular lights. (you can also add directional (if you want shadow or using have normal map on your models) and ambient light (for adjusting env map lighting i.e day/night lighting). For generating a light probe you just need to attach a SkyBox into the scene and run this code: Here is an example code of how to generate and export light probe into j3o:
and load it like below:
|
Regarding the material parameters, you have BaseColorMap, it's the same DiffuseMap we have in Phong lighting. You can adjust the metalness of the material using the "Metallic" parameter. It's a float value in [0,1]. You can optionally use Normal and Parallex textures (same as Phong lighting) and MetallicRoughness map. |
Also, you can see some PBR examples here: And here are some pre-generated light probes: Please feel free to ask if you have any questions. |
Awesome explanation, thanks! I’ll try to create an example with this info. I hope to get this update released soon. |
You're welcome. btw, in case you need, here you can download a free water texture: Some useful tips:
|
@rvandoosselaer I forgot to mention that you also need to add this in
|
I committed a PBR test case in the examples subproject. I did notice that the parallax mapping doesn’t appear to be working. |
Thanks, going to try it soon :) |
Just tried it, looks very nice :)
It does work with original PBRLighting material. Maybe something has broken while adapting it for water. |
You were correct, there was an issue in the fragment shader, it's fixed. |
It will be nice to add a PBR version of the water material. :)
The text was updated successfully, but these errors were encountered: