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"

Can I get SceneTexture as TextureObject?

I've been trying to use the custom node for my material but I've been getting errors. I'm testing the sample in the ue4 documentation:

https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/ExpressionReference/Custom/index.html

But it doesn't work. I get the error: tex2d: intrinsic function does not take 2 parameters. I wanted to test it with my post processing material where I have custom depth subtracted by scene depth and then clamped to I have custom depth object separated with black and white. I tried solutions I found don't make it any better and there's barely any information on custom nodes. I really want to know what is up with this.

EDIT: So far I'm a bit closer to getting it to work. But since SceneTexture returns as a float4, I'm still having problems. I don't know HLSL that much but from what I can see I need to use a TextureObject(Texture2d). There re two ways I think I can solve it, but I'm not sure if it's possible at the moment. First one being turning the float4 that SceneTexture gives me into a TextureObject or find a way to sample float4 in HLSL. I can't find anything to see if any of these things are possible, so I wonder if anyone knows if I can do this.

EDIT2: Updated title

Product Version: Not Selected
Tags:
more ▼

asked Dec 20 '14 at 01:46 PM in Rendering

avatar image

Admiral Skye
48 5 7 12

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Hi, about the first part of the question, since 4.6, CustomTexture is no longer needed and you need to use a TextureObject node instead. Connecting a TextureObject now provides two input parameters to your custom node function, the texture and the sampler. You need to sample it using something like this:

 Texture2DSample(Tex,TexSampler,UV);

The implementation of that function is in Common.usf. See the reply in this thread for more details: https://answers.unrealengine.com/questions/103571/custom-texture-interpreted-as-texture2d-when-tryin.html

I'll ask the docs team to update that example.

Regarding the second part, you should be able to call the existing HLSL SceneTextureLookup function from your custom node code. You can find the implementation of that in MaterialTemplate.usf.

Cheers, Jack

more ▼

answered Dec 22 '14 at 02:12 AM

avatar image

JackP_oldaccount
1.3k 37 11 47

avatar image Admiral Skye Dec 22 '14 at 04:34 AM

SceneTextureLookup is giving me the error 'undeclared identifier'. This is the what I have to test SceneTextureLookup

 output = SceneTextureLookup(uv,13,false);

avatar image JackP_oldaccount Dec 22 '14 at 04:36 AM

If you add an actual SceneTexture node, 1) does it work and 2) can you see what it's doing using the HLSL view?

(comments are locked)
10|2000 characters needed characters left

Thanks, adding an additional input node did the trick. I've been working at this for the past couple of days, it was frustrating since I couldn't find any answer despite being so close to getting the result I wanted. You were of great help.

more ▼

answered Dec 22 '14 at 04:42 AM

avatar image

Admiral Skye
48 5 7 12

(comments are locked)
10|2000 characters needed characters left
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