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"

Tangent in Matieral

Let me first say, I'm not rendering expert, so I'm hoping this is an easy one.

I'm trying to access the vertex tangent data that I have set in my mesh for my shader.

In Unity I can pull and use this data quite easily with one line of code: float4 tangent : TANGENT;

Is there an Unreal equivalent? I'm using this data to blend four textures, vertex colours, and uv channels.

Product Version: UE 4.13
Tags:
more ▼

asked Oct 28 '16 at 06:58 PM in Rendering

avatar image

StealthOne
11 2 5 7

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

2 answers: sort voted first

You can set the UV channels with the TextureCoordinate nodes, you can adress specific vertex colors with the vertex color node, and with proper use of add's and multiplies you can get rather far.

I dont know if that helps any.

more ▼

answered Oct 28 '16 at 07:55 PM

avatar image

Luos
9.3k 286 64 330

avatar image StealthOne Oct 28 '16 at 08:10 PM

Unfortunately not. I'm using 4 TextureCoordinates for the UV channels, and the Vertex Colours for the colours. I just need one more float4 through. If I had more UV channels I'd just shove the data in there.

avatar image Deathrey Oct 28 '16 at 08:20 PM

UE4 does not use TANGENT semantic anywhere as far as I know. I did not check myself, but as a wild guess, I think that tangent space is stored in a more optimized way.

If you are sure that you are running out of interpolators, you would need to modify the shaders. Material editor alone won't cope with that.

However, you could describe the actual goal you are trying to achieve? It is quite common that there is a more accessible solution for majority of tasks.

avatar image StealthOne Oct 28 '16 at 08:53 PM

Long story short, all I need to do is get an additional float4 per vertex in the shader. As I said, if I weren't already using 4 UV channels, then I'd add two more and pass through 2 float2's. I need those floats through to do some per vertex uv blending. I'm now wondering if I can pack them in with the other UV channels... which may work as long as it doesn't mind those floats being > 1.

avatar image StealthOne Oct 28 '16 at 09:39 PM

More info:

 NewData.TangentBasisComponents[0] = STRUCTMEMBER_VERTEXSTREAMCOMPONENT(VertexBuffer, FU4DProcMeshVertex, Tangent, VET_PackedNormal);
 NewData.TangentBasisComponents[1] = STRUCTMEMBER_VERTEXSTREAMCOMPONENT(VertexBuffer, FU4DProcMeshVertex, Normal, VET_PackedNormal);

Tangent and Normal are packed into the vertex data here. You can use the normal in the shader... I just need to get at that tangent data.

avatar image Luos Oct 29 '16 at 10:27 AM

Uhm.. I have meshes that use up to six, and afaik you can have 8 uv channels... or was it 16.. brain just booted up (just woke up)

avatar image StealthOne Oct 29 '16 at 08:09 PM

6 pairs? I was under the impression that there were 4 pairs of UV channels available, or 8 UV's total.

avatar image StealthOne Nov 01 '16 at 03:43 PM

You were right, supports 8 UVs on a static mesh. I wasn't using them properly. That allows me to do what I need.

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

Ok, here's the solution I went with. From Luos' comment I went searching for more UV channels. I wasn't properly using the UV channels on my mesh and bumped it up to 8 UV pairs. That allowed me to have the 4 UV channels I wanted and shove a Vec4 into another 2 UVs. I can then pull that data in the shader.

It's a pretty round-about way to get data. It'd be really nice to be able to have any amount of custom data per vertex accessible in the shader.

more ▼

answered Nov 01 '16 at 03:43 PM

avatar image

StealthOne
11 2 5 7

avatar image Luos Nov 01 '16 at 09:27 PM

This all makes me curious though, would love to see what you wanted to do with it.

If you want to request more data/vertex your best bet is probably the suggestions section on the forums :)

(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