Add Imaginando VS 2 export target - #1533
Open
douglas-carmichael wants to merge 1 commit into
Open
Conversation
Adds an 'Imaginando VS 2' export target to the standard PBR and Unlit material nodes. It generates a single GLSL fragment shader (.vs2.frag) importable by Imaginando's VS 2 (Visual Synthesizer): the material's albedo/emission/opacity channels adapted to VS 2's predeclared environment (time, alpha, color, resolution, texCoord, fragColor), preceded by the JSON manifest VS 2 requires, with float/vector uniforms baked via float_uniform_to_const and a custom text filter renaming elapsed_time to VS 2's time. Documented in the Exporting Materials page, including the two known limitations (unhyphenated $uid output; buffer-based nodes cannot be expressed in a single fragment shader).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Imaginando VS 2 export target
Adds an Imaginando VS 2 export target to the standard PBR (
material) andUnlit (
material_unlit) material nodes, plus a section in ExportingMaterials.
Imaginando VS 2
(Visual Synthesizer) is an audio-visual instrument whose materials are single
GLSL fragment shaders with a JSON manifest and a small predeclared environment
(
time,alpha,color,resolution,texCoord,fragColor). The targetgenerates one
.vs2.fragtext file:$uid(0), display name via$(file_prefix)),$definitions float_uniform_to_const,vs2— thesmall custom
vs2filter renameselapsed_timeto VS 2'stimeand bakesvec2/vec3/mat2uniforms, in the same string-replacement style as thebuilt-in unity/unreal filters,
void main()that evaluates the material's albedo, emission and opacityinside
$begin_generate(VS 2 layers are unlit, so lighting inputs such asroughness/normal are intentionally not exported) and applies VS 2's layer
alpha.
Testing
Byte-identical target definitions have been exercised as external export
targets (
user://export_targets/*.mme) on macOS with Material Maker 1.7, bothfrom the GUI and via
--export-material --target "Imaginando VS 2", and theresulting files import and render in VS 2. Embedded and external targets share
the same code path in
gen_material.gd, so behavior is identical.Known limitations (called out in the documentation)
$uid()emits 32 hex digits without hyphens, while VS 2 uses the canonicalhyphenated UUID form; inserting hyphens in 8-4-4-4-12 grouping yields a valid
v4 uuid. If there is interest, a follow-up could add a template function that
emits the hyphenated form directly, which would remove this caveat.
single fragment shader; such exports reference textures VS 2 cannot provide.