-
Notifications
You must be signed in to change notification settings - Fork 73
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-- removed --
lib/core/three/data3d-view.js
Outdated
@@ -88,7 +89,8 @@ View.prototype = { | |||
// three.js materials | |||
if (!self._materials3d[ meshId ]) { | |||
// (one material pro mesh, because some of our mesh properties are material properties and it does not matter performance wise) | |||
material3d = new THREE.MeshPhongMaterial({ opacity: 0.5, transparent: true }) | |||
//material3d = new THREE.MeshPhongMaterial({ opacity: 0.5, transparent: true}) | |||
material3d = BaseMaterial() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a problem, but I think we should restructure it later to be a proper constructor. Depending on how it'll evolve we might even be able to inherit a bunch of stuff from MeshPhongMaterial
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to get your help with this. @AVGP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4cc39cb \o/
.apdisk | ||
node_modules | ||
build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomas-polach the build
folder can be added to .gitignore
right?
|
||
<a-entity light="type: point; intensity: 0.75; distance: 50; decay: 2" position="-3.2 -2.2 -4.5"></a-entity> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the light in the example here is there to replace the standard light, right?
How are we going to deal with people who have only the default light in the scene?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomas-polach wants to build a a-frame component for an archilogic light scene.
the problem with the lights is that if there is no light present, any object with no lightmap (eg. all products) are not illuminated at all and therefore appear black.
if you add a three.js light, you can illuminate the scene (which is a pretty cool feature IMHO that comes for free) but the lightmapped objects will react much stronger to it.
It would be an option to use the lightMapIntensity parameter for a base illumination factor. (i tested that before and the results were good)
|
||
// specular coefficient | ||
|
||
material3d.shininess = _attributes.specularCoef !== undefined ? _attributes.specularCoef : 0.1 | ||
material3d.shininess = (_attributes.specularCoef !== undefined) ? (_attributes.specularCoef / 100) : 0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's "shininess" or "specular" that's the problem but the sink isn't particularly shiny :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay so it turns out that three.js is super inconsistent and "shininess" is one of the rare parameters that goes from 0 to 100 and instead of using a unit float. My bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and thanks for the catch.
|
||
if (_attributes.colorEmissive) { | ||
if (_attributes.colorEmissive && material3d.emissive) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reformat this to match diffuse and specular?
Also: Where is the corresponding uniform being set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the emission color is not yet implemented in the shader, because we currently do not support that in the editor. I could however implement it, if that is something we want to support.
@@ -117,9 +121,12 @@ export default function setMaterial (args) { | |||
// lightmap settings | |||
if (_attributes.mapLight || _attributes.mapLightPreview) { | |||
material3d.enhancedLightMap = material3d.enhancedLightMap || {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need the enhancedLightMap
property? It was used in the editor as a switch to enable our lightmap shader...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i removed enhancedLightMap because we don't need it anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commit:
487a76a
@@ -267,6 +267,7 @@ export default function loadTextures ( queue, TEXTURE_TYPES, vm, _attributes, ma | |||
} | |||
// add new texture | |||
material3d[ texture3dKeys[ i ] ] = textures[ i ] | |||
material3d.uniforms[ texture3dKeys[ i ] ].value = textures[ i ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this sets .lightMap
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also specularMap, normalMap, alphaMap und map
|
||
vec3 totalEmissiveRadiance = emissive; | ||
|
||
#include <logdepthbuf_fragment> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is logdepthbuf_pars_fragment
missing in the includes previously?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering the comment of Stavros, we say nay to logdepthbuffer for now
a54d300
IMHO there's no need for a logarithmic depth buffer in our context (interior scenes). It usually helps when you're doing very large-scale stuff, such as terrain rendering.
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); | ||
|
||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mark end-of-replaced-block here, please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lightMapCenter: { value: 0.5 }, | ||
normalMap: { value: null }, | ||
shininess: { value: 1.0 }, | ||
specular: { value: new THREE.Color(0.0, 0.0, 0.0) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this meant to be black by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. I will consider this together with the general specularity issue.
|
||
#include <uv_pars_vertex> | ||
#include <uv2_pars_vertex> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logdepthbuffer yea/nay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nay.
|
||
#include <begin_vertex> | ||
#include <project_vertex> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logdepthbuffer yea/nay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO there's no need for a logarithmic depth buffer in our context (interior scenes). It usually helps when you're doing very large-scale stuff, such as terrain rendering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @stavros-papadopoulos. i will remove the one include then that accidentally is there
That's weird, but cool that you found it :-)
2017-06-27 14:58 GMT+02:00 Madlaina Kalunder <notifications@github.com>:
… ***@***.**** commented on this pull request.
------------------------------
In lib/core/three/data3d-view/set-material.js
<#4 (comment)>
:
>
// specular coefficient
- material3d.shininess = _attributes.specularCoef !== undefined ? _attributes.specularCoef : 0.1
+ material3d.shininess = (_attributes.specularCoef !== undefined) ? (_attributes.specularCoef / 100) : 0.1
okay so it turns out that three.js is super inconsistent and "shininess"
is one of the rare parameters that goes from 0 to 100 and instead of using
a unit float. My bad.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAWmRhtpnoFYKpGj7rABbyRaNSV2SNeuks5sIPx0gaJpZM4OBEQ->
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
emissive.g = _attributes.colorEmissive[ 1 ] | ||
emissive.b = _attributes.colorEmissive[ 2 ] | ||
} else if (_attributes.lightEmissionCoef) { | ||
var emissiveIntensity = _attributes.lightEmissionCoef / 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is reasonable but I'd welcome a small comment explaining why we're dividing by 10
See issue #3
I took the shader & shader includes directly from three.js and created our own base-shaderMaterial based on their MeshPhong Material:
MeshPhong Fragment
MeshPhong Vertex
I stripped it from includes that we currently are not using, eg. skinning, shadowmaps etc.
we can add any of these easily if it turns out that we need them.
finally I added the lightmap controls (based on the editor) in the fragment shader.
looking forward to your review on this pull request