x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Unable to sample custom texture inside custom expression

Hello,

I am unable to sample textures inside a "Custom" node. I get an error saying cannot implicitly convert 'Texture2D' to 'sampler2D'. I have attached a screenshot of my setup below.

My custom expression code:

 float4 myTexture = tex2D(In, Texcoord);
 return myTexture;



alt text

Product Version: Not Selected
Tags:
capture.jpg (199.6 kB)
more ▼

asked May 30 '14 at 05:45 PM in Bug Reports

avatar image

HypnoticShark
617 23 29 47

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Hello HypnoticShark,

Unfortunately, You can't sample a texture from within a custom expression. This is a known limitation that we currently do not support. But, I have raised awareness about this issue and expect it to be fixed in a future release.

~Sam

more ▼

answered Jun 02 '14 at 07:38 PM

avatar image HypnoticShark Jun 02 '14 at 09:12 PM

I see. Well I guess this documentation page needs to be updated in that case. https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/ExpressionReference/Custom/index.html

Thanks!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi.

I found a temporary solution as explained here : https://forums.unrealengine.com/showthread.php?405-HLSL-code-Texture2D-to-sampler2D

when analysing hlsl code, It seems that the CustomTexture node generate a Texture2D, but Custom node wait a sampler2D as argument function...

I would request a fix for custom node (and/or custom texture) and a real window to edit code instead of a single line text box.

thanks.

more ▼

answered Jun 05 '14 at 09:09 PM

avatar image

fredakilla
16 2

avatar image HypnoticShark Jun 05 '14 at 09:29 PM

Thats awesome! thanks fredakilla and yes I agree with the real window to edit code thing.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

It is officially supported since about 4.7:

 Tex.Sample(TexSampler,UV);

(if your texture pin is named Tex)

References: http://oliverm-h.blogspot.sk/2014/12/ue4-quick-tip-sampling-textures-in.html https://answers.unrealengine.com/questions/455514/undeclared-identifier-texsampler.html

However it did not work for me, I had to use this:

  Tex.SampleLevel(TexSampler, UV, 0);

References: http://shaderbits.com/blog/uv-dilation

more ▼

answered May 03 '18 at 09:37 PM

avatar image

Skylonxe
81 4 5 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question