S&box Wiki

Revision Difference

Shader_Reference#545909

<cat>Code.Shader</cat> <title>Shader Reference</title> # Variables Variables will show up in Material Editor. They're defined like this. ``` float3 g_vColorTint < UiType( Color ); Default3( 1.0, 1.0, 1.0 ); UiGroup( "Color,10/20" ); >; ``` ## UiType Describes how the variable should be represented in the editor. |Name|Description| |-----|----------| | VectorText | Text boxes and sliders (this is the default) | | Slider | A slider type. Usually combined with a Range setting. | | Color | A Color picker, works on float3 or float4. | | Texture | A texture picker | | CheckBox | On or off, generally used on bool | ## Default The Default lets you specify the default value for the variable. If you're filling a `float2`, it should be `Default2`, if you're filling a `float4` it should be `Default4` etc. ## UiGroup The UiGroup is used to sort the variable into a group, subgroup and define its order. So for example, given this.. ``` float4 BorderColorL < UiType( Color ); Default4( 0.0, 0.0, 0.0, 1.0 ); UiGroup( "Border,10/Colors,10/1" ); >; float4 BorderColorT < UiType( Color ); Default4( 0.0, 0.0, 0.0, 1.0 ); UiGroup( "Border,10/Colors,10/2" ); >; float4 BorderColorR < UiType( Color ); Default4( 0.0, 0.0, 0.0, 1.0 ); UiGroup( "Border,10/Colors,10/3" ); >; float4 BorderColorB < UiType( Color ); Default4( 0.0, 0.0, 0.0, 1.0 ); UiGroup( "Border,10/Colors,10/4" ); >; ``` You end up with this <upload src="1/8d89e07e3fc960b.png" size="16898" name="image.png" /> The format is: ``` Heading,Order / Group,Order / VariableOrder ``` # Internal Shader Includes This is a list of shaders that are included internally: | Shader Includes | |--------| | ambient_cube.fxc |⤶ | baked_lighting_constants.fxc |⤶ | bindlessfastpath.fxc | | common.fxc | | descriptor_set_support.fxc |⤶ | encoded_normals.fxc |⤶ | glsl_compat.fxc |⤶ | instancing.fxc | | light_probe_volume.fxc | | lighting_model.fxc | | math_general.fxc | | morph.fxc | | msaa_offsets.fxc | | pcss.fxc | | reflection.fxc | | sbox_lighting.fxc | | sbox_pixel.fxc | | sbox_shared.fxc | | sbox_vertex.fxc | | sfm_lighting_nocombos.fxc |⤶ | sky.fxc |⤶ | sun_shadowing.fxc | | system.fxc | | texture_blending.fxc | | transform_buffer.fxc | | turbo.fxc | | volumetric_fog.fxc | | vr_common.fxc | | vr_common_features.fxc | | vr_common_ps_code.fxc | | vr_common_ps_input.fxc | | vr_common_samplers.fxc | | vr_common_vs_code.fxc | | vr_common_vs_input.fxc | | vr_cubemap_fog.fxc | | vr_detail_texture.fxc | | vr_environment_map.fxc | | vr_foliage_animation.fxc | | vr_foliage_uv_animation.fxc | | vr_gradient_fog.fxc | | vr_lighting.fxc | | vr_per_view_lighting_constants.fxc | | vr_pre_baked_vertex_animation.fxc | | vr_shared_standard_features.fxc | | vr_shared_standard_ps_input.fxc | | vr_shared_standard_vs_code.fxc | | vr_shared_standard_vs_input.fxc | | vr_spherical_vignette.fxc | | vr_tools_vis.fxc | | vs_decompress.fxc |