Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
c5f08ace
Commit
c5f08ace
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
coloring improvements
parent
4f7d6bdc
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/apps/canvas/structure-view.ts
+1
-1
1 addition, 1 deletion
src/apps/canvas/structure-view.ts
src/mol-gl/shader/direct-volume.frag
+27
-1
27 additions, 1 deletion
src/mol-gl/shader/direct-volume.frag
src/mol-gl/shader/mesh.frag
+5
-5
5 additions, 5 deletions
src/mol-gl/shader/mesh.frag
with
33 additions
and
7 deletions
src/apps/canvas/structure-view.ts
+
1
−
1
View file @
c5f08ace
...
...
@@ -70,7 +70,7 @@ export async function StructureView(app: App, viewer: Viewer, models: ReadonlyAr
const
active
:
{
[
k
:
string
]:
boolean
}
=
{
cartoon
:
true
,
point
:
false
,
surface
:
tru
e
,
surface
:
fals
e
,
ballAndStick
:
false
,
carbohydrate
:
false
,
spacefill
:
false
,
...
...
This diff is collapsed.
Click to expand it.
src/mol-gl/shader/direct-volume.frag
+
27
−
1
View file @
c5f08ace
...
...
@@ -48,6 +48,20 @@ uniform sampler2D tMarker;
#pragma glslify: texture3dFrom2dNearest = require(./utils/texture3d-from-2d-nearest.glsl)
#pragma glslify: texture3dFrom2dLinear = require(./utils/texture3d-from-2d-linear.glsl)
// uniform vec3 uLightPosition;
uniform
vec3
uLightColor
;
uniform
vec3
uLightAmbient
;
uniform
mat4
uView
;
#pragma glslify: attenuation = require(./utils/attenuation.glsl)
#pragma glslify: calculateSpecular = require(./utils/phong-specular.glsl)
#pragma glslify: calculateDiffuse = require(./utils/oren-nayar-diffuse.glsl)
const
float
specularScale
=
0
.
15
;
const
float
shininess
=
200
.
0
;
const
float
roughness
=
100
.
0
;
const
float
albedo
=
0
.
95
;
#if defined(dGridTexType_2d)
vec4
textureVal
(
vec3
pos
)
{
return
texture3dFrom2dLinear
(
tGridTex
,
pos
,
uGridDim
,
uGridTexDim
);
...
...
@@ -135,7 +149,19 @@ vec4 raymarch(vec3 startLoc, vec3 step, vec3 viewDir) {
color
=
readFromTexture
(
tColor
,
instance
*
float
(
uGroupCount
)
+
group
,
uColorTexDim
).
rgb
;
#endif
src
.
rgb
=
color
*
abs
(
dot
(
gradient
,
viewDir
));
vec3
L
=
normalize
(
viewDir
);
// light direction
vec3
V
=
normalize
(
viewDir
);
// eye direction
vec3
N
=
normalize
(
gradient
);
// surface normal
// compute our diffuse & specular terms
float
specular
=
calculateSpecular
(
L
,
V
,
N
,
shininess
)
*
specularScale
;
vec3
diffuse
=
uLightColor
*
calculateDiffuse
(
L
,
V
,
N
,
roughness
,
albedo
);
vec3
ambient
=
uLightAmbient
;
// add the lighting
vec3
finalColor
=
color
.
rgb
*
(
diffuse
+
ambient
)
+
specular
;
src
.
rgb
=
finalColor
;
src
.
a
=
uAlpha
;
float
marker
=
readFromTexture
(
tMarker
,
instance
*
float
(
uGroupCount
)
+
group
,
uMarkerTexDim
).
a
*
256
.
0
;
...
...
This diff is collapsed.
Click to expand it.
src/mol-gl/shader/mesh.frag
+
5
−
5
View file @
c5f08ace
...
...
@@ -15,7 +15,7 @@ uniform vec3 uLightColor;
uniform
vec3
uLightAmbient
;
uniform
mat4
uView
;
#if
n
def
dFlatShaded
#if
!
def
ined(
dFlatShaded
) || !defined(enabledStandardDerivatives)
varying
vec3
vNormal
;
#endif
...
...
@@ -23,9 +23,9 @@ uniform mat4 uView;
#pragma glslify: calculateSpecular = require(./utils/phong-specular.glsl)
#pragma glslify: calculateDiffuse = require(./utils/oren-nayar-diffuse.glsl)
const
float
specularScale
=
0
.
6
5
;
const
float
shininess
=
1
00
.
0
;
const
float
roughness
=
5
.
0
;
const
float
specularScale
=
0
.
1
5
;
const
float
shininess
=
2
00
.
0
;
const
float
roughness
=
100
.
0
;
const
float
albedo
=
0
.
95
;
void
main
()
{
...
...
@@ -45,7 +45,7 @@ void main() {
vec3
V
=
normalize
(
vViewPosition
);
// eye direction
// surface normal
#ifdef
dFlatShaded
#if
def
ined(
dFlatShaded
) && defined(enabledStandardDerivatives)
vec3
fdx
=
dFdx
(
vViewPosition
);
vec3
fdy
=
dFdy
(
vViewPosition
);
vec3
N
=
-
normalize
(
cross
(
fdx
,
fdy
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment