ProtoFlux:SampleTexture2DUV: Difference between revisions

From Resonite Wiki
broken title
m Add example image
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
[
[
{"Name":"Texture", "Type":"Texture2D"},
{"Name":"Texture", "Type":"Texture2D"},
{"Name":"UV", "Type":"float2"}
{"Name":"UV", "Type":"float2"},
{"Name":"WrapMode", "Type":"WrapMode"}
]
]
|Outputs=
|Outputs=
Line 25: Line 26:
The raw asset of an [[Type:IAssetProvider`1|IAssetProvider<Texture2D>]] extracted using a [[ProtoFlux:Get Asset|Get Asset Node]].
The raw asset of an [[Type:IAssetProvider`1|IAssetProvider<Texture2D>]] extracted using a [[ProtoFlux:Get Asset|Get Asset Node]].


=== UV ([[Types:Float2|Float2]]) ===
=== UV ([[Type:Float2|Float2]]) ===


The UV position to sample the colorX from.
The UV position to sample the colorX from.
=== WrapMode ([[Type:WrapMode|WrapMode]]) ===
Which mode should be used when sampling past the UV 0-1 space.


== Outputs ==  
== Outputs ==  
Line 33: Line 38:
=== * ([[Type:ColorX|colorX]]) ===
=== * ([[Type:ColorX|colorX]]) ===


The ColorX color from the provided Texture ([[Type:IAsset`1|IAsset<Texture2D>]]) at the provided UV Position ([[Types:Float2|Float2]]).
The ColorX color from the provided Texture ([[Type:IAsset`1|IAsset<Texture2D>]]) at the provided UV Position ([[Type:Float2|Float2]]).


== Examples ==
== Examples ==
<gallery widths=480px heights=480px>
<gallery widths="480" heights="480">
File:Protoflux_texture_asset_parsing.webp|Example of a Sample Texture2D UV being used in a larger example code reading 3D and 2D textures.
File:GetTexture2DPixelAndSampleTexture2DUV.png|Example of GetTexture2DPixel And SampleTexture2DUV sampling color from a generated UV texture
</gallery>
</gallery>


[[Category:ProtoFlux:Assets]]
[[Category:ProtoFlux:Assets]]

Latest revision as of 16:23, 19 December 2025

Sample Texture 2D UV
Texture
*
UV
WrapMode
Assets


Sample texture 2D UV is a node that allows you to sample the pixel color of an 2 dimensional Texture that has readable enabled based on a 0->1 range on UV instead of pixels. Since the StaticTexture2D component needs to have readable enabled, most players opt to keep a component on the object that their code is on, and then change it's URL so they can read the image's pixels.

This node also takes a raw IAsset<Texture2D> instead of an asset provider. To extract the raw texture reference from the provider for use in this node, see the Get Asset Node.

Inputs

Texture (IAsset<Texture2D>)

The raw asset of an IAssetProvider<Texture2D> extracted using a Get Asset Node.

UV (Float2)

The UV position to sample the colorX from.

WrapMode (WrapMode)

Which mode should be used when sampling past the UV 0-1 space.

Outputs

* (colorX)

The ColorX color from the provided Texture (IAsset<Texture2D>) at the provided UV Position (Float2).

Examples