-
Notifications
You must be signed in to change notification settings - Fork 838
[SG2]Imposter nodes and documents #7865
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
tracychen1234
wants to merge
21
commits into
sg2/main
Choose a base branch
from
sg2/imposter-sg2-nodes
base: sg2/main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
82888d0
Imposter nodes and documents
tracychen1234 dba3cd2
sg1 imposter nodes
tracychen1234 a38c695
Revert "sg1 imposter nodes"
tracychen1234 fb5a527
Merge remote-tracking branch 'origin/sg2/main' into sg2/imposter-sg2-…
tracychen1234 44fe29c
fixed docs base on Ben's feedback
tracychen1234 0c77862
more fixes
tracychen1234 0c7dac1
get rid of imposter clip input
tracychen1234 bbe953f
get rid of clip imput on node
tracychen1234 7aadd3d
move most of math to imposter uv node
tracychen1234 ad08bc3
Revert "move most of math to imposter uv node"
tracychen1234 8b716a3
sg2 changes
tracychen1234 d3bb993
sg2 imposter nodes: move/reorder ports
tracychen1234 99f8a30
move billboard node to correct location
tracychen1234 b88a51c
move imposter nodes to utility folder
tracychen1234 32098b4
more fixes
tracychen1234 b23a3e8
change input ports order
tracychen1234 94653a0
move frames to uv node and add a texel size input on uv node
tracychen1234 9fd2d13
changed texel size to texture resolution
tracychen1234 8920dcf
fix typo
tracychen1234 fadeda1
tweaks based on Ben's feedback
tracychen1234 2ba3f7d
fix typos
tracychen1234 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Imposter Sample Node | ||
|
||
## Description | ||
|
||
Uses the UV coordinates generated by the Imposter UV node to sample an specific imposter texture. | ||
This creates the illusion of a 3D object on a billboard object because the imposter texture's frame changes based on the camera direction and angle. | ||
If the imposter object has more than one texture to sample (e.g. color, normal, mask, occlusion, etc,), multiple Imposter Sample nodes can be used. | ||
## Ports | ||
|
||
| Name | Direction | Type | Description | | ||
|:------------ |:-------------|:-----|:---| | ||
| Texture | Input | Texture2D | The texture asset to sample | | ||
| Sampler | Input | Sampler State | The texture sampler to use for sampling the texture | | ||
| UV0 | Input | Vector2 | The virtual UV for the base frame | | ||
| UV1 | Input | Vector2 | The virtual UV for the second frame | | ||
| UV2 | Input | Vector2 | The virtual UV for the third frame | | ||
| Grid | Input | Vector4 | The current UV grid, which is used to find the corresponding sample frames | | ||
| Weights | Input | Float | The blending values in between the slected three frames| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be a Vector4 |
||
| RGBA | Output | Vector3 | A vector4 from the sampled texture | | ||
tracychen1234 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| RGB | Output | Vector3 | A vector3 from the sampled texture | | ||
| R | Output | Float | The r channel of the sampled texture | | ||
| G | Output | Float | The g channel of the sampled texture | | ||
| B | Output | Float | The b channel of the sampled texture | | ||
| A | Output | Float | The a channel of the sampled texture | | ||
|
||
## Controls | ||
|
||
The Imposter Sample Node [!include[nodes-controls](./snippets/nodes-controls.md)] | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th><strong>Name</strong></th> | ||
<th><strong>Sample Type</strong></th> | ||
<th colspan="2"><strong>Description</strong></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td rowspan="3"><strong>Type</strong></td> | ||
<td rowspan="3">Dropdown</td> | ||
<td colspan="2">Select whether to sample three frames or one frame.</td> | ||
</tr> | ||
<tr> | ||
<td><strong>Three Frames</strong></td> | ||
<td>Blends between three frames to get the smoothest result.</td> | ||
</tr> | ||
<tr> | ||
<td><strong>One Frame</strong></td> | ||
<td>Calculates only one frame for better performance. UV1, UV2 and Weights inputs won't be shown.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
## Generated code example | ||
|
||
[!include[nodes-generated-code](./snippets/nodes-generated-code.md)], based on the selected Mode on the Imposter Sample Node node: | ||
|
||
### ThreeFrames | ||
|
||
``` | ||
ImposterSample( Texture.tex, TexelSize, Weights, Grid, UV0, UV1, UV2, Sampler.samplerstate, RGBA); | ||
``` | ||
|
||
### OneFrame | ||
|
||
``` | ||
ImposterSample_oneFrame( Texture.tex, TexelSize, Weights, Grid, UV0, UV1, UV2, Sampler.samplerstate, RGBA); | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Imposter UV Node | ||
|
||
## Description | ||
|
||
The Imposter UV Node calculates the billboard position and the UV coordinates needed by the Imposter Sample node. | ||
## Ports | ||
|
||
| Name | Direction | Type | Description | | ||
|:------------ |:-------------|:-----|:---| | ||
| In Position | Input | Vector3 | The postion in Object space | | ||
| In UV | Input | Vector4 | The UV coordinates of the mesh | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be a Vector2. We won't ever need the other two channels. |
||
| Frames | Input | Float | The number of the imposter frames in each axis| | ||
tracychen1234 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Size | Input | Float | The size of the imposter | | ||
tracychen1234 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Offset | Input | Float | The offset value from the pivot | | ||
tracychen1234 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Frame Clipping Threshold | Input | Float | The clamping value for the neighboring frames most useful when parallax mapping is enabled | | ||
| Texture Size | Input | Float | The resolution of the texture. | | ||
tracychen1234 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| HemiSphere | Input | Boolean | If it's true, calculates the imposter grid and UVs base on hemisphere type.This is Useful if the imposter object will only be seen from above | | ||
| Parallax | Input | Float | Parallax strength, if it equals to 0 than he parallax related control won't affect the outputs.| | ||
| Height map | Input | Texture2D | The height map texture to sample | | ||
| Sampler | Input | Sampler State | The texture sampler to use for sampling the texture | | ||
| Height Map Channel | Input | Int | The channle of the height map to sample for parallax mapping, if any| | ||
tracychen1234 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Out Positon | Output | Vector3 | The output billboard position | | ||
| UV0 | Output | Vector2 | The virtual UV for the base frame | | ||
| UV1 | Output | Vector2 | The virtual UV for the second frame | | ||
| UV2 | Output | Vector2 | The virtual UV for the third frame | | ||
| Grid | Output | Vector4 | The current UV grid, which is used to find the corresponding sample frames | | ||
| Weights | Output | Vector4 | he blending values in between the slected three frames | | ||
|
||
|
||
## Controls | ||
|
||
The Imposter UV Node [!include[nodes-controls](./snippets/nodes-controls.md)] | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th><strong>Name</strong></th> | ||
<th><strong>Sample Type</strong></th> | ||
<th colspan="2"><strong>Description</strong></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td rowspan="3"><strong>Type</strong></td> | ||
<td rowspan="3">Dropdown</td> | ||
<td colspan="2">Select whether to sample three frames or one frame.</td> | ||
</tr> | ||
<tr> | ||
<td><strong>Three Frames</strong></td> | ||
<td>Blends between three frames to get the smoothest result.</td> | ||
</tr> | ||
<tr> | ||
<td><strong>One Frame</strong></td> | ||
<td>Calculates only one frame for better performance. UV1, UV2 and Weights outputs won't be shown.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
## Generated code example | ||
|
||
[!include[nodes-generated-code](./snippets/nodes-generated-code.md)], based on the selected Mode on the Imposter Sample Node node: | ||
|
||
### ThreeFrames | ||
|
||
``` | ||
ImposterUV(Pos, inUV, Frames, Offset, Size, imposterFrameClip, HemiSphere, Parallax, HeightMapChannel, ss, HeightMap, TextureSize, OutPos, Weights, Grid, UV0, UV1, UV2) | ||
``` | ||
|
||
### OneFrame | ||
|
||
``` | ||
ImposterUV_oneFrame(Pos, inUV, Frames, Offset, Size, imposterFrameClip, HemiSphere, Parallax, HeightMapChannel, ss, HeightMap, TextureSize, OutPos, Grid, UV0); | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Description | ||
Uses the UV coordinates generated by the Imposter UV node to sample an specific imposter texture. | ||
This creates the illusion of a 3D object on a billboard object because the imposter texture's frame changes based on the camera direction and angle. | ||
|
||
## Inputs | ||
**Texture** - The texture asset to sample. | ||
**Sampler** - The texture sampler to use for sampling the texture. | ||
**UV0** - The virtual UV for the base frame. | ||
**UV1** - The virtual UV for the second frame. | ||
**UV2** - The virtual UV for the third frame. | ||
**Grid** - The current UV grid, which is used to find the corresponding sample frames. | ||
**Weights** - The blending values in between the slected three frames. | ||
|
||
## Output | ||
**RGBA** - A vector4 from the sampled texture. | ||
**RGB** - A vector3 from the sampled texture. | ||
**R** - The r channel of the sampled texture. | ||
**G** - The g channel of the sampled texture. | ||
**B** - The b channel of the sampled texture. | ||
**A** - The a channel of the sampled texture. | ||
|
||
## Controls | ||
**Sample Type** - Select whether to sample three frames or one frame, three frames for smoother result, one frame for better performance. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## Description | ||
Calculates the billboard positon and the virtual UVs for sampling. | ||
|
||
## Inputs | ||
**InPosition** - The postion in Object space. | ||
**In UV** - The UV coordinates of the mesh. | ||
**Frames** - The number of the imposter frames in each axis. | ||
**Size** - The size of the imposter. | ||
**Offset** - The offset value from the pivot. | ||
**Frame Clipping Threshold** - The clamping value for the neighboring frames most useful when parallax mapping is enabled. | ||
**Texture Size** - The texture resolution. | ||
**Height Map** - The height map texture to sample. | ||
**Sampler** - The texture sampler to use for sampling the texture. | ||
**Parallax** - Parallax strength. | ||
**Height Map Channel** - The channle of the height map to sample for parallax mapping, if any. | ||
**HemiSphere** - If it's true, calculates the imposter grid and UVs base on hemisphere type. Useful if the object is only seen from above. | ||
|
||
## Output | ||
**OutPosition** - The output billboard position. | ||
**UV0** - The virtual UV for the base frame. | ||
**UV1** - The virtual UV for the second frame. | ||
**UV2** - The virtual UV for the third frame. | ||
**Grid** - The current UV grid using to find the sample frames. | ||
|
||
## Controls | ||
**Sample Type** - Select whether to sample three frames or one frame, three frames for smoother result, one frame for better performance. |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.