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"

PixelNormalWS breaks on Android but works in all preview modes

  • Engine: 4.6 with C++ project

  • OS: Windows 7

  • Packaged: Using File > Package Project > Android > Android (ETC2), Mobile HDR: off

  • Device: Samsung Galaxy Note 3

Issue

We wanted to add a custom light source inside our character material. We supply a vector parameter, being world location, and then we calculate a simple Phong shader. (calculate world vector -> normalize -> dot(light vector, surface normal))

Our shader works in PIE, StandAlone, Mobile Previewer and the experimental Feature Level Preview ES2.

Shader breaks after deployment to mobile. It seems the PixelNormalWS node returns a default value rather than the actual surface normal. So light source always appear to light the same side of the model, no matter what value we supply to the vector parameter.

Temporary Solution

I managed to solve the problem by fetching the normal map color and then transform the tangent vector to world space. Same result as PixelNormalWS, but does not break on mobile.

Repro

This is the shader network that we use. alt text

Product Version: Not Selected
Tags:
more ▼

asked Dec 16 '14 at 10:51 AM in Rendering

avatar image

Denny
1.1k 28 34 69

avatar image Denny Dec 16 '14 at 11:06 AM

This is how it looks like in the viewport and on the device. Note that the result on the right is what we expect, and which works by using the transform vector node instead of PixelNormalWS.

alt text

avatar image Denny Dec 16 '14 at 04:41 PM

We have been having other lighting issues on mobile, based on static lighting, which has resulted in completely wrong lit characters. I just found out that the Two Sided option breaks lighting on mobile. It seems the effect is that lighting gets the wrong normals for two sided rendering. As if the front facing polygon gets the back facing normal and vice versa.

I think it is related to this issue. Because if I am not mistaken, the tangent to world transform should still work even if the normal of the face is pointing in the wrong direction.

avatar image Lovecraft_K ♦♦ STAFF Dec 18 '14 at 05:16 PM

Hey Denny -

I set this up in 4.6.1 and am not seeing any difference when I deploy on a Samsung Galaxy Note 3, it looks as intended in all available viewports and game modes. If you can upload a sample project with this issue for further testing?

Thank You

Eric Ketchum

avatar image Denny Dec 18 '14 at 05:51 PM

Hi Eric, I am not at work for another week. Did you test using TwoSided material? The TwoSided switch is what finally caused the issue seen above.

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

1 answer: sort voted first

Hey Denny -

I was able to track down the issue and it has been fixed in the internal branch of the engine. It should be forthcoming in a Hot Fix or Major Engine Release.

Thank You

Eric Ketchum

more ▼

answered Dec 19 '14 at 09:25 PM

avatar image

Lovecraft_K ♦♦ STAFF
36.8k 701 255 733

(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