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"

Access vertex position in materials

Hi, how do i access the vertex position in the material editor?

Product Version: Not Selected
Tags:
more ▼

asked Aug 06 '14 at 09:35 AM in Rendering

avatar image

Eqric
89 19 26 31

avatar image Lovecraft_K ♦♦ STAFF Aug 07 '14 at 07:07 PM

Hey Eqric -

You can adjust the vertex positions using the World Position Offset input in your material setup. Are you looking for a way to call a particular vertex position? Can you let me know what you are ultimately trying to achieve and I can probably point you in the correct direction.

Thank You

Eric Ketchum

avatar image Lovecraft_K ♦♦ STAFF Aug 11 '14 at 01:32 PM

Hi Eqric -

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

Eric Ketchum

avatar image Eqric Aug 18 '14 at 07:27 PM

Sorry, i was away on a trip. Not quite what i asked for, i need to find out the vertex position in the world, but i later found out about the "Absolute World Position" and it looks promising.

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

1 answer: sort voted first

Hey Eqric -

If I am understanding what you want to do, then teh Absolute World Position node should be able to give you access to the information you need. As you work on it, if you have further questions feel free to ask here.

Thank You

Eric Ketchum

more ▼

answered Aug 18 '14 at 07:59 PM

avatar image

Lovecraft_K ♦♦ STAFF
36.6k 703 260 737

avatar image son1cman May 21 '15 at 03:56 PM

Im not him but i have a question, im coming from unity and want to create this simple shader into material nodes:

  struct appdata_t  //appdata_tan: vertex consists of position, tangent, normal and one texture coordinate.
         {
             float4 vertex : POSITION;
             float3 normal : NORMAL;
         };

         struct v2f //fragmentInput
         {
             float4 pos : SV_POSITION;
         };

         fixed _Outline;//Editor Parameter

         
         v2f vert (appdata_t v) 
         {
             v2f o;
             o.pos = v.vertex;
             o.pos.xyz += v.normal.xyz *_Outline*0.01;
             o.pos = mul(UNITY_MATRIX_MVP, o.pos);
             return o;
         }
         
         fixed4 _OutlineColor;
         
         fixed4 frag(v2f i) :COLOR 
         {
             return _OutlineColor;
         }
         I dont know how to translate this onto unreal material
avatar image Lovecraft_K ♦♦ STAFF May 21 '15 at 07:42 PM

Hi son1cman -

I am not as familiar with ShaderLab language can you let me know what you shader is supposed to yield? (Picture example from Unity would be fine as well)

Thank You

Eric Ketchum

avatar image son1cman May 22 '15 at 03:57 AM

Hi there!!!

alt text

As you can see the shader does the black outline on the mesh.... (I know you can do this outline using post process effect material and custom depth, but this option doesnt work for mobile)

I have done some research and come up to this conclusion:

The World Position Offset input allows for the vertices of a mesh to be manipulated in world space by the Material(This shader just "extrude" each vertex along his normal vector) Theres a content example that extrudes vertex, but i dont know how to make it outline my object. (https://docs.unrealengine.com/latest/INT/Resources/ContentExamples/MaterialNodes/1_10/index.html)

avatar image Lovecraft_K ♦♦ STAFF May 22 '15 at 04:14 PM

Hi son1cman -

There are two options that you can try here. Assuming your mesh is mostly smooth edged (not right angles meeting), you can try a setup like this:

Outline_byPixel

which yields results like this:

Outline_Final

As you can see there are issues with the way the outline is applied here which case the top pixels to render in the same depth resulting in the black top.

Alternatively and probably better ultimately for performance and for most accurate outline would be the old method of doing outlines which is to duplicate the mesh, increase the duplicate's scale by a small outline (thickness of your outline) and invert the face normals.

In this case you would end up with each results very close to the post process method like this:

Outline_Double

Thank You

Eric Ketchum

outline.jpg (215.9 kB)
outline_final.jpg (56.7 kB)
outline_double.jpg (85.4 kB)
avatar image son1cman May 22 '15 at 05:19 PM

Thanks for this awesome reply.... how do you invert the normals on unreal? can you post the project files for the post process double mesh example? Thanks Erick

avatar image Lovecraft_K ♦♦ STAFF May 26 '15 at 07:32 PM

Hi son1cman -

No, the normals were inverted in Maya and imported back into the engine. Feel free to export the Cube and Sphere Mesh in this project for details.

Thank You -

Eric Ketchum

Mobile_Outlines

(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