-
Notifications
You must be signed in to change notification settings - Fork 146
WIP: JDK-8217477: Implement attenuation-coefficients for PointLight #384
base: develop
Are you sure you want to change the base?
Conversation
Adding attenuation factors to the JavaFX 3D-API
Added SetRange opeator
I'm not sure if this is super WIP or not but it's pretty non-standard to add comments to all the changes with your handle "FalcoTheBold" as that's what git/hg history is for. Not a big deal just pointing it out this superficial (non-code related) detail. |
- Added missing shader-files - Changed default values of attenuation-factors
@brcolow They can indeed be considered super WIP, these comments are just reminders from the time when i worked on the code apart from my usual work station and are supposed to be removed/replaced later of course. |
- added missing members for native MeshView-struct - changed 'la' to correct data-type in native setPointLight-operation
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.
OpenJFX uses spaces in stead of tabs, please change this.
Moreover, there are many spacing changes, such as in D3DContext.java and I'm not sure at all these are within the style conventions of OpenJFX. Kevin would have to comment on this I think.
The comments with your name and what you changed might be useful for reviewers, just remember to remove them later.
.idea/misc.xml
Outdated
<component name="IdProvider" IDEtalkID="9BC0DE4049720C1246C2D3B835C6F7C3" /> | ||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
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 don't think changes to IDE files belong in this patch. Is it necessary?
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.
No, these were set by my IDE when i imported OpenJFX it seems, but i changed these back already. Thus it will be resetted within the next commits.
@@ -82,8 +85,12 @@ void main() | |||
vec3 l = normalize(lightTangentSpacePositions[0].xyz); | |||
d = clamp(dot(n,l), 0.0, 1.0)*(lights[0].color).rgb; | |||
s = pow(clamp(dot(-refl, l), 0.0, 1.0), power)*lights[0].color.rgb; | |||
|
|||
//FalcoTheBold - added attenuation calculation for a single light | |||
float dist = (lights[0].pos.xyz - gl_Position) / lights[0].atten.range; |
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 don't understand this. If the distance from the pixel to the light is lights[0].pos.xyz - gl_Position
, why divide by the range? If that distance is larger than the range, the light should have no effect. I don't see how this happens.
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.
Honestly, tiredness got the better of me that time and i was led too much by findings in other forums regarding how to use the range in these places. Truly an error on my part there. There will be a conditional element regarding the affected range instead in the next commit as well.
Did you test with the test code I linked to you that both implementations produce the same results? |
I think these should be reverted. This sort of wholesale reformatting is discouraged because it makes changes harder to review (and can sometimes cause merge conflicts). |
Not yet, but i plan to do just that shortly. Regarding
I took the file as it is from the sources you provided and the IDE seems to have no issues with the indents (i use spaces, no tabs) or the likes. |
- Tabs to spaces - line at end of sources - removal of "Falco"-comments - changed policy of line separator
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.
Additional comments:
.idea/misc.xml
has been changed again.- Undo the formatting (adding extra spaces) changes to:
MeshView.java
,D3DContext.java
,LightBase.java
andD3DMeshView.java
.
|
||
private: | ||
|
||
}; | ||
|
||
#endif /* D3DLIGHT_H */ | ||
|
||
|
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.
Remove empty lines.
glContext.setPointLight(nativeHandle, index, x, y, z, r, g, b, w); | ||
/* | ||
* FacloTheBold: - new operator, added parameters for attenuation coefficients | ||
*/ |
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.
Remove this comment if you removed the rest.
|
||
gl_FragColor = vec4(clamp(rez, 0.0, 1.0) , diffuse.a); | ||
vec3 rez = (ambientColor+d) * (att * (diffuse.xyz + s*specular.rgb)); |
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 think that att
should multiply d
and s
(same as multiplying lights[0].color.rgb
). The same is done in the d3d pipeline.
The sources I uploaded do not change indentation. I'm not sure what indentation issues you are referring to. |
May i know which IDE you used for working on your sources? |
You see a Github-rookie at its finest, sorry for the inconveniences. |
I use Eclipse. |
The implementation looks promising. Can you test with the app I uploaded that we get the same visuals? |
|
||
vec3 rez = (ambientColor+d) * diffuse.xyz + s*specular.rgb; | ||
rez += apply_selfIllum().xyz; | ||
vec3 rez = (ambientColor+d) * (diffuse.xyz + s*specular.rgb); |
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'm not sure that this change to the formula is correct. d
should only multiply the diffuse color I think. Same for the other shaders.
@FalcoTheBold How's it going? We are slowly running out of time to get all the planned changes into 13. We need to leave enough time for reviewers too. |
Hello there. |
As announced in this message, the official This sandbox repository is being retired on 1-Oct-2019. You will need to migrate your WIP pull request to the openjdk/jfx repo if you want to continue working on it. Here are instructions for migrating your pull request. The updated CONTRIBUTING.md doc has additional information on how to proceed. Once you have done this, it would be helpful to add a comment with a pointer to the new PR. NOTE: since this is a feature / enhancement request it needs to be discussed on the openjfx-dev mailing list if you want it to be considered. The new openjdk/jfx repo will be open for pull requests on Wednesday, 2-Oct-2019. I will send email to the openjfx-dev mailing list announcing this. |
PR on the Skara repo: openjdk/jfx#43 |
Adding attenuation factors to the ES2-pipeline of the JavaFX 3D-API