Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Apr 2010
Offline Last Active Yesterday, 08:17 AM

Posts I've Made

In Topic: Antialiasing artifacts with render targets (or something else)

13 October 2014 - 02:20 AM

Thank you everyone,

I didn't post my shader because I don't want to scare people - stage3d shaders are assembler like code. I double checked it and it seems correct - I even don't have divisions. And the main thing - without antialiasing I don't have artifacts. So MJP's answer is the explanation I searched for. Unfortunatelly, stage3d doesn't allow to setup sampling or anything like that.


@bwhiiting, for render target AA levels are 0, 1, 2, 3, 4.


@baldurk, I have wrong results in fragment shader. For example in vertex shader I have a varing (vi0) and I can see it's value, but in fragment shader I suddenly have vi1 (not vi0) value filled with zeroes only. So I can't step through the code and check intermediate results (and output color actually is wrong too, although on the screen it's ok). But as you say it can be problem with render target - flash internally draws to some texture and internally draws it to back buffer in the end. And I tried to turn on every option.


Upd.: I checked on different machine and I can't see this artifacts, so I assume that this is my hardware's fault.

In Topic: Reading a texture inside if statement

27 September 2014 - 03:01 AM

MJP, thanks a lot. Your explanation is indeed very good. It seems that it's a problem with me smile.png . How does texture coordinates relates to your example:

if(x > 1.0f)
    x = x * 10.0f;

Sorry, I can't understand it - if shader will execute both parts of a branch and mask out wrong result - it will have the correct data anyway.

In Topic: Reading a texture inside if statement

26 September 2014 - 02:11 PM

Thank you. I've read all your links. And I understood that I'm totally confused. Why ddx/ddy can't be calculated ith branch? The pixel have have it's output color, it have interpolated values from vertex shader. Even if shader calculate both sides of the branch, it applies a mask for choosing correct color for pixel. What keeps it to apply that mask to a ddx/ddy values?

In Topic: Reading a texture inside if statement

26 September 2014 - 01:10 PM

dpadam450, stage3d is a wraper that uses directx (9 or 11) on windows, opengl on mac and opengl es on mobiles.

No idea what either of you are talking about.


From http://msdn.microsoft.com/en-us/library/windows/desktop/bb509610%28v=vs.85%29.aspx:

There are certain cases where using the branch or flatten attributes may generate a compile error. The branch attribute may fail if either side of the if statement contains a gradient function, such as tex2D.


And I can't understand this - why sampling uses gradient functions? And what's the problem if both sides of the branch executes.

In Topic: Reading a texture inside if statement

26 September 2014 - 12:15 PM

Hi, Krypt0n. Thank you. But I still don't get it. Why derivative inside inside 'if' impossible if that 'if' computes anyway? And how derivative relates to texture fetch? It's just uv I need - interpolated value from vertex shader.