Commit c0575648 authored by haiyoucuv's avatar haiyoucuv

上传

parent c99b7986
This diff is collapsed.
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "08b393f4-00f7-4c9b-b3a6-13f3933244f5",
"files": [],
"subMetas": {},
"userData": {}
}
import { Vec4, gfx, postProcess, renderer, rendering } from "cc";
import { MotionBlurSetting } from "./MotionBlurSetting";
export class MotionBlurPass extends postProcess.SettingPass {
// custom pass name
name = 'CustomPass'
// out out slot name
outputNames: string[] = ['CustomPassColor']
// reference to post process setting
get setting() {
return this.getSetting(MotionBlurSetting);
}
// Whether the pass should rendered
checkEnable(camera: renderer.scene.Camera): boolean {
let setting = this.setting;
return setting.material && super.checkEnable(camera);
}
params = new Vec4
render(camera: renderer.scene.Camera, ppl: rendering.Pipeline) {
const cameraID = this.getCameraUniqueID(camera);
// clear background to black color
const context = this.context;
context.clearBlack()
// input name from last pass's output slot 0
const input0 = this.lastPass.slotName(camera, 0);
// output slot 0 name
const output = this.slotName(camera, 0);
// get depth slot name
const depth = context.depthSlotName;
// also can get depth slot name from forward pass.
// let forwardPass = builder.getPass(ForwardPass);
// depth = forwardPass.slotName(camera, 1);
// set setting value to material
const setting = this.setting;
// this.params.x = setting.blueIntensity
// this.params.y = setting.showDepth ? 1 : 0;
// this.params.z = setting.depthRange;
// setting.material.setProperty('params', this.params);
context.material = setting.material;
context
// update view port
.updatePassViewPort()
// add a render pass
.addRenderPass('post-process', `${this.name}${cameraID}`)
// set inputs
.setPassInput(input0, 'inputTexture')
.setPassInput(depth, 'depthTexture')
// set outputs
.addRasterView(output, gfx.Format.RGBA8)
// final render
.blitScreen(0)
// calculate a version
.version();
}
}
let builder = rendering.getCustomPipeline('Custom') as postProcess.PostProcessBuilder;
if (builder) {
// insert CustomPass after a BlitScreenPass
builder.insertPass(new MotionBlurPass(), postProcess.BlitScreenPass);
}
\ No newline at end of file
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "12640f6d-b2f9-49e6-ac3e-b467b2c2afc9",
"files": [],
"subMetas": {},
"userData": {}
}
import { _decorator, Material, postProcess } from 'cc';
const { ccclass, property, menu } = _decorator;
@ccclass('MotionBlurSetting')
@menu('PostProcess/MotionBlurSetting')
export class MotionBlurSetting extends postProcess.PostProcessSetting {
@property
blueIntensity = 1
@property
showDepth = false
@property
depthRange = 30
@property(Material)
_material: Material | undefined
@property(Material)
get material () {
return this._material;
}
set material (v) {
this._material = v;
}
}
\ No newline at end of file
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "254e958b-6382-46fe-bce4-41d0409a40f4",
"files": [],
"subMetas": {},
"userData": {}
}
CCEffect %{
techniques:
- passes:
- vert: post-process-vs
frag: post-process-fs
pass: post-process
depthStencilState:
depthTest: false
depthWrite: false
rasterizerState:
cullMode: none
blendState:
targets:
- blend: true
blendSrc: src_alpha
blendDst: one_minus_src_alpha
blendSrcAlpha: src_alpha
blendDstAlpha: one_minus_src_alpha
properties:
outlineTexture: { value: black }
blendIntensity: { value: 0.5 }
outlineColor: { value: [ 0, 0, 0, 1 ], editor: { type: color } }
outlineWidth: { value: 0.1 }
}%
CCProgram post-process-vs %{
precision highp float;
#include <legacy/decode-standard>
#include <builtin/uniforms/cc-global>
#include <common/common-define>
out vec2 v_uv;
void main () {
StandardVertInput In;
CCDecode(In);
CC_HANDLE_GET_CLIP_FLIP(In.position.xy);
gl_Position = In.position;
v_uv = a_texCoord;
}
}%
CCProgram ubo %{
uniform PostUBO {
vec4 outlineColor;
float blendIntensity;
float outlineWidth;
};
uniform sampler2D outlineTexture;
#pragma rate inputTexture pass
uniform sampler2D inputTexture;
#pragma rate depthTexture pass
uniform sampler2D depthTexture;
}%
CCProgram post-process-fs %{
precision highp float;
#include <builtin/uniforms/cc-global>
in vec2 v_uv;
#include <ubo>
layout(location = 0) out vec4 fragColor;
vec3 normal_from_depth(float depth, vec2 texcoords) {
const vec2 offset1 = vec2(0.0,0.001);
const vec2 offset2 = vec2(0.001,0.0);
float depth1 = texture(depthTexture, texcoords + offset1).r;
float depth2 = texture(depthTexture, texcoords + offset2).r;
vec3 p1 = vec3(offset1, depth1 - depth);
vec3 p2 = vec3(offset2, depth2 - depth);
vec3 normal = cross(p1, p2);
normal.z = -normal.z;
return normalize(normal);
}
void main () {
vec4 color = texture(inputTexture, v_uv);
vec4 outline = texture(outlineTexture, v_uv);
float depth = texture(depthTexture, v_uv).r;
float sizeX = outlineWidth * 1.0 / cc_screenSize.x;
float sizeY = outlineWidth * 1.0 / cc_screenSize.y;
float alpha = -8.0 * outline.a;
alpha += texture(outlineTexture, v_uv + vec2(0.0, -sizeY)).a;
alpha += texture(outlineTexture, v_uv + vec2(sizeX, -sizeY)).a;
alpha += texture(outlineTexture, v_uv + vec2(sizeX, 0)).a;
alpha += texture(outlineTexture, v_uv + vec2(sizeX, sizeY)).a;
alpha += texture(outlineTexture, v_uv + vec2(0.0, sizeY)).a;
alpha += texture(outlineTexture, v_uv + vec2(-sizeX, sizeY)).a;
alpha += texture(outlineTexture, v_uv + vec2(-sizeX, 0.0)).a;
alpha += texture(outlineTexture, v_uv + vec2(-sizeX, -sizeY)).a;
vec4 final_color = mix(color, outlineColor, clamp(alpha, 0.0, 1.0));
fragColor = vec4(final_color.rgb, clamp(abs(alpha) + outline.a, 0.0, 1.0));
fragColor = final_color;
vec3 normal = normal_from_depth(depth, v_uv);
fragColor = vec4(normal, 1.0);
}
}%
{
"ver": "1.7.1",
"importer": "effect",
"imported": true,
"uuid": "1ff0a4be-fc26-4582-978f-ee433132e2b8",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}
{
"__type__": "cc.Material",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"_effectAsset": {
"__uuid__": "1ff0a4be-fc26-4582-978f-ee433132e2b8",
"__expectedType__": "cc.EffectAsset"
},
"_techIdx": 0,
"_defines": [
{}
],
"_states": [
{
"rasterizerState": {},
"depthStencilState": {},
"blendState": {
"targets": [
{}
]
}
}
],
"_props": [
{}
]
}
\ No newline at end of file
{
"ver": "1.0.21",
"importer": "material",
"imported": true,
"uuid": "c6d6a624-7ee7-4ac7-b72b-59995211cdb5",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
<!--<link rel="apple-touch-icon" href=".png" />--> <!--<link rel="apple-touch-icon" href=".png" />-->
<!--<link rel="apple-touch-icon-precomposed" href=".png" />--> <!--<link rel="apple-touch-icon-precomposed" href=".png" />-->
<script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726034425115/src/assets/plugin/zepto.min.js"></script> <script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726057349058/src/assets/plugin/zepto.min.js"></script>
<script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726034425115/src/assets/plugin/declare-process.js"></script> <script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726057349058/src/assets/plugin/declare-process.js"></script>
<script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726034425115/src/assets/plugin/SVGA.Lite.v2.1.1.js"></script> <script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726057349058/src/assets/plugin/SVGA.Lite.v2.1.1.js"></script>
<link rel="stylesheet" type="text/css" href="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726034425115/style.css" /> <link rel="stylesheet" type="text/css" href="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726057349058/style.css" />
<link rel="stylesheet" type="text/css" href="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726034425115/custom.css" /> <link rel="stylesheet" type="text/css" href="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726057349058/custom.css" />
<script type="text/javascript" src="https://appx/web-view.min.js"></script> <script type="text/javascript" src="https://appx/web-view.min.js"></script>
...@@ -51,16 +51,16 @@ ...@@ -51,16 +51,16 @@
</div> </div>
<!-- Polyfills bundle. --> <!-- Polyfills bundle. -->
<script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726034425115/src/polyfills.bundle.js" charset="utf-8"></script> <script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726057349058/src/polyfills.bundle.js" charset="utf-8"></script>
<!-- SystemJS support. --> <!-- SystemJS support. -->
<script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726034425115/src/system.bundle.js" charset="utf-8"></script> <script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726057349058/src/system.bundle.js" charset="utf-8"></script>
<!-- Import map --> <!-- Import map -->
<script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726034425115/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script> <script src="//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726057349058/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>
<script> <script>
System.import('//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726034425115/index.js').catch(function (err) { System.import('//duiba-credits-test.oss-cn-hangzhou.aliyuncs.com/TNGD_GAMES/Cave_Cruiser/1726057349058/index.js').catch(function (err) {
console.error(err); console.error(err);
}) })
</script> </script>
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
"_value": true "_value": true
}, },
"custom-pipeline": { "custom-pipeline": {
"_value": true "_value": false
}, },
"graphcis": { "graphcis": {
"_value": true "_value": true
...@@ -137,7 +137,6 @@ ...@@ -137,7 +137,6 @@
"3d", "3d",
"animation", "animation",
"base", "base",
"custom-pipeline",
"debug-renderer", "debug-renderer",
"geometry-renderer", "geometry-renderer",
"gfx-webgl", "gfx-webgl",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"height": 1624 "height": 1624
}, },
"downloadMaxConcurrency": 20, "downloadMaxConcurrency": 20,
"renderPipeline": "fd8ec536-a354-4a17-9c74-4f3883c378c8" "renderPipeline": "c7e748e8-be82-4f6f-b2c0-085b604e40e5"
}, },
"custom_joint_texture_layouts": [], "custom_joint_texture_layouts": [],
"physics": { "physics": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment