-
Notifications
You must be signed in to change notification settings - Fork 358
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
usd_preview_surface_plastic is missing highlights in MaterialXTest #2109
Comments
Hi @krohmerNV, I think this may be due to disabling direct lighting in the test suite options:
One way to check to see if the results are the same or to enable the option. I'm not sure if turning direct lighting off in MaterialXView is the same. |
Okay, I can check that. But shouldn't that effect more results? |
I thought that might be the case could be a "red herring". I tried rendering this file via unit tests based on a local build at current head of repo on Windows (*) Without making any option changes it seems to render okay ?
I don't quite understand what's going on when you turn off the direct toggle in MaterialXView :
I dumped out the shader from MaterialXView and there are no active lights (no direct lighting) (*) I noticed that USD and OpenPBR folders seem to be omitted from the test suite as well ? I had to add the USD material path to get the rendered using Anyways, it would be good to address any inconsistencies in setup for the different render paths as I find it hard to triage this :). GLSL Shader```c++ #version 400struct BSDF { vec3 response; vec3 throughput; }; // Uniform block: PrivateUniforms // Uniform block: PublicUniforms in VertexData // Pixel shader outputs #define M_FLOAT_EPS 1e-8 #define mx_mod mod float mx_square(float x) vec2 mx_square(vec2 x) vec3 mx_square(vec3 x) vec3 mx_srgb_encode(vec3 color) #define DIRECTIONAL_ALBEDO_METHOD 0 #define MAX_LIGHT_SOURCES 4 float mx_pow5(float x) float mx_pow6(float x) // Standard Schlick Fresnel // Generalized Schlick Fresnel // Generalized Schlick Fresnel with a variable exponent // Enforce that the given normal is forward-facing from the specified view direction. // https://www.graphics.rwth-aachen.de/publication/2/jgt.pdf // https://people.irisa.fr/Ricardo.Marques/articles/2013/SF_CGF.pdf // Generate a uniform-weighted sample on the unit hemisphere. // Generate a cosine-weighted sample on the unit hemisphere. // Construct an orthonormal basis from a unit vector. const int FRESNEL_MODEL_DIELECTRIC = 0; // Parameters for Fresnel calculations
}; // https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf // https://ggx-research.github.io/publication/2023/06/09/publication-ggx.html
} // https://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.pdf // Height-correlated Smith masking-shadowing // Rational quadratic fit to Monte Carlo data for GGX directional albedo. vec3 mx_ggx_dir_albedo_table_lookup(float NdotV, float alpha, vec3 F0, vec3 F90) // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf
} vec3 mx_ggx_dir_albedo(float NdotV, float alpha, vec3 F0, vec3 F90) float mx_ggx_dir_albedo(float NdotV, float alpha, float F0, float F90) // https://blog.selfshadow.com/publications/turquin/ms_comp_final.pdf float mx_ggx_energy_compensation(float NdotV, float alpha, float Fss) // Compute the average of an anisotropic alpha pair. // Convert a real-valued index of refraction to normal-incidence reflectivity. // Convert normal-incidence reflectivity to real-valued index of refraction. // https://renderwonk.com/publications/wp-generalization-adobe/gen-adobe.pdf
} // https://seblagarde.wordpress.com/2013/04/29/memo-on-fresnel-equations/
} // https://seblagarde.wordpress.com/2013/04/29/memo-on-fresnel-equations/
} // https://seblagarde.wordpress.com/2013/04/29/memo-on-fresnel-equations/
} vec3 mx_fresnel_conductor(float cosTheta, vec3 n, vec3 k) // https://belcour.github.io/blog/research/publication/2017/05/01/brdf-thin-film.html
} // https://belcour.github.io/blog/research/publication/2017/05/01/brdf-thin-film.html // A Practical Extension to Microfacet Theory for the Modeling of Varying Iridescence
} FresnelData mx_init_fresnel_dielectric(float ior, float tf_thickness, float tf_ior) FresnelData mx_init_fresnel_conductor(vec3 ior, vec3 extinction, float tf_thickness, float tf_ior) FresnelData mx_init_fresnel_schlick(vec3 F0, vec3 F82, vec3 F90, float exponent, float tf_thickness, float tf_ior) vec3 mx_compute_fresnel(float cosTheta, FresnelData fd) // Compute the refraction of a ray through a solid sphere. vec2 mx_latlong_projection(vec3 dir) vec3 mx_latlong_map_lookup(vec3 dir, mat4 transform, float lod, sampler2D envSampler) // Return the mip level with the appropriate coverage for a filtered importance sample. vec3 mx_environment_radiance(vec3 N, vec3 V, vec3 X, vec2 alpha, int distribution, FresnelData fd)
} vec3 mx_environment_irradiance(vec3 N) vec3 mx_surface_transmission(vec3 N, vec3 V, vec3 X, vec2 alpha, int distribution, FresnelData fd, vec3 tint) struct LightData uniform LightData u_lightData[MAX_LIGHT_SOURCES]; void mx_point_light(LightData light, vec3 position, out lightshader result) void mx_spot_light(LightData light, vec3 position, out lightshader result) void mx_directional_light(LightData light, vec3 position, out lightshader result) int numActiveLightSources() void sampleLightSource(LightData light, vec3 position, out lightshader result) void mx_roughness_anisotropy(float roughness, float anisotropy, out vec2 result) void mx_artistic_ior(vec3 reflectivity, vec3 edge_color, out vec3 ior, out vec3 extinction)
} void mx_uniform_edf(vec3 N, vec3 L, vec3 color, out EDF result) void mx_normalmap_vector2(vec3 value, vec2 normal_scale, vec3 N, vec3 T, vec3 B, out vec3 result) void mx_normalmap_float(vec3 value, float normal_scale, vec3 N, vec3 T, vec3 B, out vec3 result) void NG_convert_float_color3(float in1, out vec3 out1) void mx_generalized_schlick_bsdf_reflection(vec3 L, vec3 V, vec3 P, float occlusion, float weight, vec3 color0, vec3 color82, vec3 color90, float exponent, vec2 roughness, float thinfilm_thickness, float thinfilm_ior, vec3 N, vec3 X, int distribution, int scatter_mode, inout BSDF bsdf)
} void mx_generalized_schlick_bsdf_transmission(vec3 V, float weight, vec3 color0, vec3 color82, vec3 color90, float exponent, vec2 roughness, float thinfilm_thickness, float thinfilm_ior, vec3 N, vec3 X, int distribution, int scatter_mode, inout BSDF bsdf)
} void mx_generalized_schlick_bsdf_indirect(vec3 V, float weight, vec3 color0, vec3 color82, vec3 color90, float exponent, vec2 roughness, float thinfilm_thickness, float thinfilm_ior, vec3 N, vec3 X, int distribution, int scatter_mode, inout BSDF bsdf)
} const float FUJII_CONSTANT_1 = 0.5 - 2.0 / (3.0 * M_PI); // Qualitative Oren-Nayar diffuse with simplified math:
} // Rational quadratic fit to Monte Carlo data for Oren-Nayar directional albedo. float mx_oren_nayar_diffuse_dir_albedo_table_lookup(float NdotV, float roughness) float mx_oren_nayar_diffuse_dir_albedo_monte_carlo(float NdotV, float roughness)
} float mx_oren_nayar_diffuse_dir_albedo(float NdotV, float roughness) // Improved Oren-Nayar diffuse from Fujii: float mx_oren_nayar_fujii_diffuse_avg_albedo(float roughness) // Energy-compensated Oren-Nayar diffuse from OpenPBR Surface:
} vec3 mx_oren_nayar_compensated_diffuse_dir_albedo(float cosTheta, float roughness, vec3 color) // https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf // Compute the directional albedo component of Burley diffuse for the given // Evaluate the Burley diffusion profile for the given distance and diffusion shape. // Integrate the Burley diffusion profile over a sphere of the given radius.
} vec3 mx_subsurface_scattering_approx(vec3 N, vec3 L, vec3 P, vec3 albedo, vec3 mfp) void mx_oren_nayar_diffuse_bsdf_reflection(vec3 L, vec3 V, vec3 P, float occlusion, float weight, vec3 color, float roughness, vec3 normal, bool energy_compensation, inout BSDF bsdf)
} void mx_oren_nayar_diffuse_bsdf_indirect(vec3 V, float weight, vec3 color, float roughness, vec3 normal, bool energy_compensation, inout BSDF bsdf)
} void mx_dielectric_bsdf_reflection(vec3 L, vec3 V, vec3 P, float occlusion, float weight, vec3 tint, float ior, vec2 roughness, float thinfilm_thickness, float thinfilm_ior, vec3 N, vec3 X, int distribution, int scatter_mode, inout BSDF bsdf)
} void mx_dielectric_bsdf_transmission(vec3 V, float weight, vec3 tint, float ior, vec2 roughness, float thinfilm_thickness, float thinfilm_ior, vec3 N, vec3 X, int distribution, int scatter_mode, inout BSDF bsdf)
} void mx_dielectric_bsdf_indirect(vec3 V, float weight, vec3 tint, float ior, vec2 roughness, float thinfilm_thickness, float thinfilm_ior, vec3 N, vec3 X, int distribution, int scatter_mode, inout BSDF bsdf)
} void mx_conductor_bsdf_reflection(vec3 L, vec3 V, vec3 P, float occlusion, float weight, vec3 ior_n, vec3 ior_k, vec2 roughness, float thinfilm_thickness, float thinfilm_ior, vec3 N, vec3 X, int distribution, inout BSDF bsdf)
} void mx_conductor_bsdf_indirect(vec3 V, float weight, vec3 ior_n, vec3 ior_k, vec2 roughness, float thinfilm_thickness, float thinfilm_ior, vec3 N, vec3 X, int distribution, inout BSDF bsdf)
} void IMP_UsdPreviewSurface_surfaceshader(vec3 diffuseColor, vec3 emissiveColor, int useSpecularWorkflow, vec3 specularColor, float metallic, float roughness, float clearcoat, float clearcoatRoughness, float opacity, float opacityThreshold, float ior, vec3 normal, float displacement, float occlusion, out surfaceshader out1)
} void main()
|
@krohmerNV Thanks for posting this issue, and it's definitely worthy of additional investigation, as that behavior is not expected at all. @kwokcb It's important to remember that our render test suite uses combined HDRIs rather than split direct and indirect lighting terms, since OSL's |
There is this USD Preview Surface test for plastic that is not showing highlights in the GLSL/OSL renderings in the render tests:
https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/resources/Materials/Examples/UsdPreviewSurface/usd_preview_surface_plastic.mtlx
If I open the material in MaterialXView I do see the expected highlights . The MDL test renders also produce the highlight.
The graph seems to follow spec and uses a white F90:
MaterialX/libraries/bxdf/usd_preview_surface.mtlx
Line 197 in bef88b9
The text was updated successfully, but these errors were encountered: