This repository has been archived by the owner on Jul 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Sceneform to Filament 1.7.0 and include source files. (#1088)
* Update to Filament 1.7.0 and include material sources * Remove dependency on view renderable sfb, add source exr for lighting.
- Loading branch information
Showing
25 changed files
with
435 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2018 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="#E61976d2"/> | ||
<corners android:radius="5dp"/> | ||
</shape> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<TextView xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" | ||
android:background="@drawable/rounded_bg" | ||
android:gravity="center" | ||
android:orientation="vertical" | ||
android:padding="6dp" | ||
android:text="Tiger" | ||
android:textAlignment="center" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
sceneformsrc/sceneform/sampleData/sceneform_camera_material.mat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
material { | ||
"name" : "Camera", | ||
|
||
"parameters" : [ | ||
{ | ||
"type" : "samplerExternal", | ||
"name" : "cameraTexture" | ||
} | ||
], | ||
"requires" : [ | ||
"uv0" | ||
], | ||
"vertexDomain" : "device", | ||
"depthWrite" : false, | ||
"shadingModel" : "unlit", | ||
"doubleSided" : true | ||
} | ||
fragment { | ||
void material(inout MaterialInputs material) { | ||
prepareMaterial(material); | ||
|
||
vec4 color = texture(materialParams_cameraTexture, getUV0()); | ||
material.baseColor.rgb = inverseTonemapSRGB(color.rgb); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
sceneformsrc/sceneform/sampleData/sceneform_opaque_colored_material.mat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
material { | ||
"name" : "Opaque Colored", | ||
|
||
"parameters" : [ | ||
{ | ||
"type" : "float3", | ||
"name" : "color" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "metallic" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "roughness" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "reflectance" | ||
} | ||
], | ||
"requires" : [ | ||
"position", | ||
"uv0" | ||
], | ||
"shadingModel" : "lit", | ||
"blending" : "opaque" | ||
} | ||
fragment { | ||
void material(inout MaterialInputs material) { | ||
prepareMaterial(material); | ||
material.baseColor.rgb = materialParams.color; | ||
material.metallic = materialParams.metallic; | ||
material.roughness = materialParams.roughness; | ||
material.reflectance = materialParams.reflectance; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
sceneformsrc/sceneform/sampleData/sceneform_opaque_textured_material.mat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
material { | ||
"name" : "Opaque Textured", | ||
|
||
"parameters" : [ | ||
{ | ||
"type" : "sampler2d", | ||
"name" : "texture" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "metallic" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "roughness" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "reflectance" | ||
} | ||
], | ||
"requires" : [ | ||
"position", | ||
"uv0" | ||
], | ||
"shadingModel" : "lit", | ||
"blending" : "opaque" | ||
} | ||
fragment { | ||
void material(inout MaterialInputs material) { | ||
prepareMaterial(material); | ||
material.baseColor = texture(materialParams_texture, getUV0()); | ||
material.metallic = materialParams.metallic; | ||
material.roughness = materialParams.roughness; | ||
material.reflectance = materialParams.reflectance; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
sceneformsrc/sceneform/sampleData/sceneform_plane_material.mat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
material { | ||
name : "AR Core Plane Material", | ||
|
||
"parameters": [ | ||
{ | ||
"type": "sampler2d", | ||
"name": "texture" | ||
}, | ||
{ | ||
"type": "float3", | ||
"name": "color" | ||
}, | ||
{ | ||
"type": "float2", | ||
"name": "uvScale" | ||
}, | ||
{ | ||
"type": "float3", | ||
"name": "focusPoint" | ||
}, | ||
{ | ||
"type": "float", | ||
"name": "radius" | ||
} | ||
], | ||
"variables" : [ | ||
"texCoordsAlpha", | ||
"smoothWorldPosition" | ||
], | ||
"requires" : [ | ||
"position" | ||
], | ||
shadingModel : unlit, | ||
"blending": "transparent" | ||
} | ||
|
||
vertex { | ||
void materialVertex(inout MaterialVertexInputs material) { | ||
float3 pos = getPosition().xyz; | ||
|
||
// The Y position of the vertex represents the Alpha of the plane at this Vertex. | ||
material.texCoordsAlpha.z = pos.y; | ||
|
||
// Zero out the Y vertex and compute the world position. | ||
pos.y = 0.0; | ||
material.worldPosition = mulMat4x4Float3(getWorldFromModelMatrix(), pos); | ||
material.smoothWorldPosition = material.worldPosition; | ||
|
||
// Compute the texture coordinates. | ||
// The X axis of the texture corresponds to the local X axis of the plane. | ||
// The Y axis of the texture corresponds to the local Z axis of the plane. | ||
// Scale the texture coordinates by the scale parameter passed into the material. | ||
material.texCoordsAlpha.x = pos.x * materialParams.uvScale.x; | ||
material.texCoordsAlpha.y = pos.z * materialParams.uvScale.y; | ||
} | ||
} | ||
|
||
fragment { | ||
void material(inout MaterialInputs material) { | ||
prepareMaterial(material); | ||
|
||
material.baseColor = texture(materialParams_texture, variable_texCoordsAlpha.xy); | ||
material.baseColor.rgb *= materialParams.color; | ||
float textureAlpha = material.baseColor.a; | ||
|
||
// Create a spotlight effect around the focus point. | ||
float distToFocus = distance(variable_smoothWorldPosition.xyz, materialParams.focusPoint); | ||
float alpha = smoothstep(materialParams.radius, materialParams.radius * .5f, distToFocus); | ||
|
||
// Transparent blending uses pre-multiplied alpha, | ||
// so multiply the entire baseColor by the alpha for this fragment. | ||
material.baseColor *= variable_texCoordsAlpha.z * alpha; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
sceneformsrc/sceneform/sampleData/sceneform_plane_shadow_material.mat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
material { | ||
name : "AR Core Plane Shadow Material", | ||
shadingModel : unlit, | ||
blending : transparent, | ||
shadowMultiplier : true | ||
} | ||
|
||
vertex { | ||
void materialVertex(inout MaterialVertexInputs material) { | ||
float3 pos = getPosition().xyz; | ||
|
||
// Shift the verticies upwards so we don't z-fight with the plane material. | ||
pos.y = 0.005f; | ||
material.worldPosition = mulMat4x4Float3(getWorldFromModelMatrix(), pos); | ||
} | ||
} | ||
|
||
fragment { | ||
void material(inout MaterialInputs material) { | ||
prepareMaterial(material); | ||
|
||
material.baseColor = float4(0.0f, 0.0f, 0.0f, .6f); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
sceneformsrc/sceneform/sampleData/sceneform_transparent_colored_material.mat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
material { | ||
"name" : "Transparent Colored", | ||
|
||
"parameters" : [ | ||
{ | ||
"type" : "float4", | ||
"name" : "color" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "metallic" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "roughness" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "reflectance" | ||
} | ||
], | ||
"requires" : [ | ||
"position", | ||
"uv0" | ||
], | ||
"shadingModel" : "lit", | ||
"blending" : "transparent" | ||
} | ||
fragment { | ||
void material(inout MaterialInputs material) { | ||
prepareMaterial(material); | ||
material.baseColor = materialParams.color; | ||
material.metallic = materialParams.metallic; | ||
material.roughness = materialParams.roughness; | ||
material.reflectance = materialParams.reflectance; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
sceneformsrc/sceneform/sampleData/sceneform_transparent_textured_material.mat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
material { | ||
"name" : "Transparent Textured", | ||
|
||
"parameters" : [ | ||
{ | ||
"type" : "sampler2d", | ||
"name" : "texture" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "metallic" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "roughness" | ||
}, | ||
{ | ||
"type" : "float", | ||
"name" : "reflectance" | ||
} | ||
], | ||
"requires" : [ | ||
"position", | ||
"uv0" | ||
], | ||
"shadingModel" : "lit", | ||
"blending" : "transparent" | ||
} | ||
fragment { | ||
void material(inout MaterialInputs material) { | ||
prepareMaterial(material); | ||
material.baseColor = texture(materialParams_texture, getUV0()); | ||
material.metallic = materialParams.metallic; | ||
material.roughness = materialParams.roughness; | ||
material.reflectance = materialParams.reflectance; | ||
} | ||
} |
Oops, something went wrong.