-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add envmap generation for environments #38
base: master
Are you sure you want to change the base?
Conversation
i realize that this probably won't bundle properly, having includes in the index.js. If this is something you think would belong in this component we can figure out a solution, otherwise i can package this up as its own optional sibling component |
Nice work! I'll leave to others whether this should be part of the environment component but my hunch would be a separate component makes best sense. A few other comments:
var materials = Array.isArray(mesh.material) ? mesh.material: [mesh.material];
materials.forEach((material) => {
if (material.isMeshStandardMaterial) {
material.envMap = this.envMap;
material.needsUpdate = true;
}
}); If you go the separate component route, could also include some more options: <a-scene env-map-generator="sourcePosition: 0 1.6 0;
near: 0.1;
far: 1000;
resolution: 512;">
</a-scene> Could also attach the component within the scene, to have an inherent position.... can't decide if I prefer that vs this scene-level singleton syntax. |
the reason i removed the environment elements is because i didn't want to apply the envmap onto anything inside the actual environment objects. A better way will be to just check if the environment component is an ancestor of the object im traversing. I'm going to pull this into a separate compoenent and will post a link here. |
So talking with @donmccurdy a bit in the slack, and if this is a separate component, we need a way to target just the environment elements (actually we need it if its built in too). We were thinking we could add an "environment-object" class name or something to all the children in this component, so when people add an environment map they can target all .environment-object's and anythign else they want in the reflections. This is necessary because if you add environment component to the a-scene element, there's no way to get just the environment tags, and not the rest of the scene. |
Dude, this is brilliant, thanks for making this. Yup, I agree with @donmccurdy and I think this should be a separated component, so everybody can benefit from it, not only environment-component users. Yup, I do agree on adding a classname to the entities in this component. Will do it asap. |
Cool I have a separate component set up. Let me know when you add
classnames so I can finalize and publish mine
…On Tue, Mar 20, 2018 at 5:14 PM Diego F. Goberna ***@***.***> wrote:
Dude, this is brilliant, thanks for making this. Yup, I agree with
@donmccurdy <https://github.com/donmccurdy> and I think this should be a
separated component, so everybody can benefit from it, not only
environment-component users.
Yup, I do agree on adding a classname to the entities in this component.
Will do it asap.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/feiss/aframe-environment-component/pull/38#issuecomment-374800337>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJ1b35STs-i_6oUoeLzep5l8XODheCKks5tgZtlgaJpZM4SvfHO>
.
|
done! |
looks very cool, but you mark this.el with the class, and this.el is the scene element a lot of times (for example in the examples set up via angle). This would cause everything in the scene to be captured. |
Also minor nit i would vote for just |
yeah ok! |
oh @msfeldstein , when you have the component ready, could you open a PR here modifying the README, explaining how to use it with the environment? thanks a lot! (Add a section called sth like "Environment Map Generation" before the "Performance" section, for example) |
Here's what ive got so far. I don't want to publish this until this aframe-environment-component pushes a new version so people can get the latest with the class names. It does work great though! https://github.com/msfeldstein/aframe-environment-map-component/blob/master/README.md |
PBR materials, particularly anything metallic, don't look good without an envmap. They are very dark. With this change, an envmap will be automatically generated with the environment component, and applied to any materials in the scene. Here is an example of a before and after.