Skip to content

Modify shader example to show using build in includes #1086

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BastiaanOlij
Copy link
Contributor

@BastiaanOlij BastiaanOlij commented Jul 11, 2024

This enhancement of the post_shader demo adds in logic that brings in build in defines for our scene data uniform, so we have access to projection matrices and other information.

image

Requires godotengine/godot#94193

@BadMachine

This comment was marked as off-topic.

@BastiaanOlij
Copy link
Contributor Author

The upstream PR this showcases functionality for was merged.

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me!

@@ -115,7 +134,8 @@ func _render_callback(p_effect_callback_type: EffectCallbackType, p_render_data:
# Get our render scene buffers object, this gives us access to our render buffers.
# Note that implementation differs per renderer hence the need for the cast.
var render_scene_buffers := p_render_data.get_render_scene_buffers()
if render_scene_buffers:
var scene_data := p_render_data.get_render_scene_data()
if render_scene_buffers && scene_data:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if render_scene_buffers && scene_data:
if render_scene_buffers and scene_data:

depth_uniform.add_id(depth_image)
var uniform_set := UniformSetCacheRD.get_cache(shader, 0, [scene_data_uniform, color_uniform, depth_uniform])

# Set our view
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Set our view
# Set our view.

# Loop through views just in case we're doing stereo rendering. No extra cost if this is mono.
var view_count: int = render_scene_buffers.get_view_count()
for view in view_count:
# Get the RID for our scene data buffer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Get the RID for our scene data buffer
# Get the RID for our scene data buffer.

@@ -137,18 +157,43 @@ func _render_callback(p_effect_callback_type: EffectCallbackType, p_render_data:
0.0,
])

# Make sure we have a sampler
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Make sure we have a sampler
# Make sure we have a sampler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants