Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambient light #10

Closed
vujadin opened this issue Jan 15, 2021 · 4 comments
Closed

Ambient light #10

vujadin opened this issue Jan 15, 2021 · 4 comments

Comments

@vujadin
Copy link
Contributor

vujadin commented Jan 15, 2021

I needed ambient light for a project so I've quickly implemented one: https://github.com/vujadin/pixi3d/tree/ambient-light
Here's the result: http://babylonhx.com/pixiambient/
Couldn't get the right result with other types of light and wasn't able to use image lighting because of a project size limit...
Would be nice to have something like this in the "official" Pixi3D.

@jnsmalm
Copy link
Owner

jnsmalm commented Jan 16, 2021

I went to http://babylonhx.com/pixiambient/ , is the issue that it's transparent?

@jnsmalm
Copy link
Owner

jnsmalm commented Jan 16, 2021

Not sure which problems you had, but using your code it works pretty well. Seems like you forgot one thing though, in standard-material.ts make sure you have the following code in "updateUniforms" function:

switch (light.type) {
        case LightType.point: type = 1; break
        case LightType.directional: type = 0; break
        case LightType.spot: type = 2; break
        case LightType.ambient: type = 3; break
      }

Also, it will make a difference depending on the settings of the material of the object (metallic and roughness).

I'll see if I can add ambient lighting in Pixi3D soon, let me know if you have additional issues.

@vujadin
Copy link
Contributor Author

vujadin commented Jan 16, 2021

My code works just fine, no issues at all. I do have that part in "updateUniforms", it wouldn't work without it:
vujadin@192a3ed#diff-fc6cad664a018cca57b22da32546f5ce77ec793efc0910233439c2acca887e82

No issues at all, this was just a suggestion for adding ambient light to the framework. Closing this now...

@vujadin vujadin closed this as completed Jan 16, 2021
@jnsmalm
Copy link
Owner

jnsmalm commented Jan 16, 2021

Thanks for the help, I added your implementation to the develop branch 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants