Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions examples/amr_render_cells.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import yt

import yt_idv

ds = yt.load_sample("Enzo_64")

rc = yt_idv.render_context(height=800, width=800, gui=True)
sg = rc.add_scene(ds, ("index", "ones"), no_ghost=True)

sg.components[0].cmap_log = False
sg.components[0].render_method = "sum_projection"

rc.run()
19 changes: 19 additions & 0 deletions yt_idv/shaders/shaderlist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ shader_definitions:
- one
- one
blend_equation: func add
sum_projection:
info:
A first pass fragment shader that performs unweighted integration of the
data along the line of sight. See :ref:`projection-types` for more information.
source:
- ray_tracing.frag.glsl
- sum_projection.frag.glsl
blend_func:
- one
- one
blend_equation: func add
text_overlay:
info: A simple text overlay shader
source: textoverlay.frag.glsl
Expand Down Expand Up @@ -217,6 +228,14 @@ component_shaders:
second_vertex: passthrough
second_fragment: apply_colormap
coordinate_systems: [cartesian, spherical]
sum_projection:
description: Unweighted sum
first_vertex: grid_position
first_geometry: grid_expand
first_fragment: sum_projection
second_vertex: passthrough
second_fragment: apply_colormap
coordinate_systems: [cartesian, spherical]
transfer_function:
description: Color transfer function
first_vertex: grid_position
Expand Down
18 changes: 18 additions & 0 deletions yt_idv/shaders/sum_projection.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
bool sample_texture(vec3 tex_curr_pos, inout vec4 curr_color, float tdelta,
float t, vec3 dir) {

vec3 offset_pos = get_offset_texture_position(ds_tex[0], tex_curr_pos);
vec3 tex_sample = texture(ds_tex[0], offset_pos).rgb;
vec3 offset_bmap_pos = get_offset_texture_position(bitmap_tex, tex_curr_pos);
float map_sample = texture(bitmap_tex, offset_bmap_pos).r;
if (map_sample > 0.0) {
float val = tex_sample.r + curr_color.r;
curr_color = vec4(val, val, val, 1.0);
}
return bool(map_sample > 0.0);
}

vec4 cleanup_phase(in vec4 curr_color, in vec3 dir, in float t0, in float t1)
{
return vec4(curr_color);
}