Jump to content

babycarlitos
 Share

Recommended Posts

Hello everyone!

 

I have been enjoying doing some interesting stuff with pixi. Then I decided to check V3 and was able to change all my projects to the new version. So far so good. Now I see on the site this nice sample

 

http://www.goodboydigital.com/pixijs/pixilights/

 

I have been trying to mimic the "shadow" that the light does to the presents to no avail.

I have checked the examples at

 

http://www.pixijs.com/examples/

 

but none have this particular feature. I did see the lights example that it is still experimental using the PIXI.lights.WebGLDeferredRendererer(W,H) but that does not give me the shadows to objects and it also separates my objects into two groups: with normals and without normals breaking my z order :(

 

so I guess my 2 questions would be:

 

1 - how can I achieve that shadow ( I looked at the presents code and it is obfuscated using require.js , was able to read some, but it will take a while to be able to make sense of it )

 

2- Is it possible to have the z order intact using PIXI.lights.WebGLDeferredRendererer ? 

Thanks for your help!

 

Link to comment
Share on other sites

The shadow is drawn to a render texture based on some ray tracing of the light through the object. Pretty standard ray-trace shows (and blur), nothing fancy going on. I hope to make the pixi-lights plugin do it for you eventually :)

 

When you say "have the z order intact" what does that mean? The only "z order" in pixi is the order of the children array, which it honors, so I don't understand the question.

Link to comment
Share on other sites

The shadow is drawn to a render texture based on some ray tracing of the light through the object. Pretty standard ray-trace shows (and blur), nothing fancy going on. I hope to make the pixi-lights plugin do it for you eventually :)

 

When you say "have the z order intact" what does that mean? The only "z order" in pixi is the order of the children array, which it honors, so I don't understand the question.

Thank you xerver for answering my questions:

 

1- I am looking into learning about ray tracing to see if I can mimic in a small example what you(or the presents example creator)  have  done . The only time I touched ray was in unity ( which you just call the function) and in 3d max (ray trace, which you also just call it) I have never actually tried to do the function myself. Any tips ( books, websites) that I can read that you can think of top of your head?

 

2- You are correct , it does honor the order, the "problem" that I am having is that I want the order to be render in the same order that the children were entered into the scene. Right now lets say that I do the following:

 

  • create 4 sprites called A,B,C,D.
  • Add them to the stage in that same order BUT I put a normal to sprites ACD

By doing that,  ACD sprites will be in order but they will be behind B. Maybe that is the correct behavior, but I would like to know if I can have them stay in the same order ABCD.

 

I can create an example of this if you would like, thanks again! 

Link to comment
Share on other sites

Oh yes, this is because there is no z-buffer at all. So unlit (or self-illuminating) objects are rendered on top :(

This is an artifact of the fact that WebGL 1 doesn't have MRT so each framebuffer render is a whole new shader pass, which is expensive. In WebGL2 we have MRT and I can make this work properly with z-buffers and proper illumination maps.

Sorry!

Link to comment
Share on other sites

Oh yes, this is because there is no z-buffer at all. So unlit (or self-illuminating) objects are rendered on top :(

This is an artifact of the fact that WebGL 1 doesn't have MRT so each framebuffer render is a whole new shader pass, which is expensive. In WebGL2 we have MRT and I can make this work properly with z-buffers and proper illumination maps.

Sorry!

No worries, thanks for answering my questions, in the meantime i will look into learning simple ray trace and reading some more about MRT since I don't really know much about webgl without using libraries.

Link to comment
Share on other sites

  • 4 months later...
On 23.09.2015 at 3:03 AM, babycarlitos said:

Hello everyone!

 

I have been enjoying doing some interesting stuff with pixi. Then I decided to check V3 and was able to change all my projects to the new version. So far so good. Now I see on the site this nice sample

 

http://www.goodboydigital.com/pixijs/pixilights/

 

I have been trying to mimic the "shadow" that the light does to the presents to no avail.

I have checked the examples at

 

http://www.pixijs.com/examples/

 

but none have this particular feature. I did see the lights example that it is still experimental using the PIXI.lights.WebGLDeferredRendererer(W,H) but that does not give me the shadows to objects and it also separates my objects into two groups: with normals and without normals breaking my z order :(

 

so I guess my 2 questions would be:

 

1 - how can I achieve that shadow ( I looked at the presents code and it is obfuscated using require.js , was able to read some, but it will take a while to be able to make sense of it )

 

2- Is it possible to have the z order intact using PIXI.lights.WebGLDeferredRendererer ? 

Thanks for your help!

 

By the way , where can I find the source code of 'avoid presents' game ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...