mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-31 23:02:06 +00:00
Realistic View: Phong Shading + Ambient Oclusion + Cast Shadows (#13704)
* Phong Shading * Add shader selection to graphics preferences * SSAO * 3D canvas menu Co-Authored-By: yw4z <yw4z@outlook.com> * better SSAO * Adjust * phong in preview mode * cast shadows sombra 3 sombra 2 * fix 1 * SSAO independent * Fix 2 * clean 1 * shadows availables with gouraud * Update Preferences.cpp * tweeks * No Normal textures * Depth texture allocation * avoid rebinding/redefining state each render. * free SSAO * set shadow fill color * remove duplicated code * cached model to avoid per-frame uploads * yw4z suggestion Co-Authored-By: yw4z <yw4z@outlook.com> * Update Preferences.cpp Co-Authored-By: yw4z <yw4z@outlook.com> * Update GLCanvas3D.cpp * only gouraud for preview mode * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Add new OpenGL shading model setting * Update src/slic3r/GUI/GLCanvas3D.cpp * Apply suggestion from @RF47 * Title Case * normal textures * gamma 2.2 Co-Authored-By: Ian Bassi <12130714+ianalexis@users.noreply.github.com> * Revert "gamma 2.2" This reverts commit 909a84af604a080b3f4b8dd67d13956473a77afe. * Reapply "gamma 2.2" This reverts commit 0f0c3d9ec0d2c9647ce06afac4fe9266b5ffda97. * AO blend Co-Authored-By: Ian Bassi <12130714+ianalexis@users.noreply.github.com> * Revert "AO blend" This reverts commit c5c9a3aa6b295704e71299451b937648e5c5f109. * 4.0 pixel radius * windows light effect direccion brillo * smoothing * ajuste de brillo * ajustes de brillo * No SSAO for bed * disable realistic view on paint gismos * Update ssao.fs * circular panel --------- Co-authored-by: yw4z <yw4z@outlook.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ian Bassi <ian.bassi@outlook.com> Co-authored-by: Ian Bassi <12130714+ianalexis@users.noreply.github.com> Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
54
resources/shaders/110/phong.vs
Normal file
54
resources/shaders/110/phong.vs
Normal file
@@ -0,0 +1,54 @@
|
||||
#version 110
|
||||
|
||||
const vec3 ZERO = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
struct SlopeDetection
|
||||
{
|
||||
bool actived;
|
||||
float normal_z;
|
||||
mat3 volume_world_normal_matrix;
|
||||
};
|
||||
|
||||
uniform mat4 view_model_matrix;
|
||||
uniform mat4 projection_matrix;
|
||||
uniform mat3 view_normal_matrix;
|
||||
uniform mat4 volume_world_matrix;
|
||||
uniform SlopeDetection slope;
|
||||
|
||||
// Clipping plane, x = min z, y = max z. Used by the FFF and SLA previews to clip with a top / bottom plane.
|
||||
uniform vec2 z_range;
|
||||
// Clipping plane - general orientation. Used by the SLA gizmo.
|
||||
uniform vec4 clipping_plane;
|
||||
// Color clip plane - general orientation. Used by the cut gizmo.
|
||||
uniform vec4 color_clip_plane;
|
||||
|
||||
attribute vec3 v_position;
|
||||
attribute vec3 v_normal;
|
||||
|
||||
varying vec3 clipping_planes_dots;
|
||||
varying float color_clip_plane_dot;
|
||||
|
||||
varying vec4 world_pos;
|
||||
varying float world_normal_z;
|
||||
varying vec3 eye_normal;
|
||||
varying vec3 eye_position;
|
||||
|
||||
void main()
|
||||
{
|
||||
// First transform the normal into camera space and normalize the result.
|
||||
eye_normal = normalize(view_normal_matrix * v_normal);
|
||||
|
||||
vec4 position = view_model_matrix * vec4(v_position, 1.0);
|
||||
eye_position = position.xyz;
|
||||
|
||||
// Point in homogenous coordinates.
|
||||
world_pos = volume_world_matrix * vec4(v_position, 1.0);
|
||||
|
||||
// z component of normal vector in world coordinate used for slope shading
|
||||
world_normal_z = slope.actived ? (normalize(slope.volume_world_normal_matrix * v_normal)).z : 0.0;
|
||||
|
||||
gl_Position = projection_matrix * position;
|
||||
// Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded.
|
||||
clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z);
|
||||
color_clip_plane_dot = dot(world_pos, color_clip_plane);
|
||||
}
|
||||
Reference in New Issue
Block a user