Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix engine bug #329

Merged
merged 42 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3e7daef
fix: fix gltf sample
X-OldGentleMan Nov 1, 2023
cdea600
chore: fix type
lslzl3000 Nov 1, 2023
2cf8dbf
fix: fix chromaKey material
X-OldGentleMan Nov 1, 2023
d814610
Merge branch 'dev-0.7fix' of https://github.com/X-OldGentleMan/orillu…
X-OldGentleMan Nov 1, 2023
63a00c5
chore: fix VideoMateial
lslzl3000 Nov 1, 2023
ebafec7
fix: fix grass sample
X-OldGentleMan Nov 3, 2023
b8f5097
Merge branch 'dev' of https://github.com/Orillusion/orillusion into d…
X-OldGentleMan Nov 3, 2023
f979173
fix: fix resize
X-OldGentleMan Nov 4, 2023
dbc4c40
fix: fix canvas resize change gpu attachments texture
X-OldGentleMan Nov 5, 2023
8e44f66
fix: fix resize events
X-OldGentleMan Nov 5, 2023
bb633e4
fix: fix sample grass
X-OldGentleMan Nov 5, 2023
0096d38
fix: resize by ResizeObserver
lslzl3000 Nov 5, 2023
23f996a
add post test
lslzl3000 Nov 5, 2023
d04f1d5
fix: fix post sample resize bug
X-OldGentleMan Nov 6, 2023
080ba1b
change model url
lslzl3000 Nov 6, 2023
fee3cc8
feat: Fix csm shadow.
hellmor Nov 6, 2023
8c9b1c8
chore: add sample
X-OldGentleMan Nov 7, 2023
1871dc6
Merge branch 'dev-0.71-GraphicTri' of https://github.com/X-OldGentleM…
X-OldGentleMan Nov 7, 2023
9a492ff
fix: Cancel automatic resizing of rendertexture in GI
hellmor Nov 7, 2023
3d6c4fe
feat: add graphic ribbon
X-OldGentleMan Nov 8, 2023
01b678f
Merge branch 'dev-0.71-GraphicTri' of https://github.com/X-OldGentleM…
X-OldGentleMan Nov 8, 2023
51a38f2
fix: Wrong offset for bloom.
hellmor Nov 8, 2023
7f121a5
Merge branch 'dev-0.71-GraphicTri' of github.com:X-OldGentleMan/orill…
hellmor Nov 8, 2023
89ef8d3
perf: reduce texture sample times.
hellmor Nov 9, 2023
febdf23
feat: fix issues #304
hellmor Nov 10, 2023
acfb2b4
chore: move GodRay setting from post file to engine setting
hellmor Nov 13, 2023
fc99f78
chore: get param from setting.
hellmor Nov 13, 2023
6e40eab
feat: add new graphic face
X-OldGentleMan Nov 14, 2023
d601378
fix index.ts
lslzl3000 Nov 14, 2023
5deb703
chore: Hide light debug line
Codeboy-cn Nov 14, 2023
a0d8ea1
chore: Remove sample GraphicTrailing
Codeboy-cn Nov 14, 2023
ed8d2f5
update physics car sample
lslzl3000 Nov 14, 2023
00d951b
Merge branch 'dev-0.7.2-GraphicFace' of github.com:X-OldGentleMan/ori…
lslzl3000 Nov 14, 2023
d372e85
chore: modify error information
Codeboy-cn Nov 14, 2023
5769144
Merge branch 'dev-0.7.2-GraphicFace' of github.com:X-OldGentleMan/ori…
Codeboy-cn Nov 14, 2023
0939b29
fix: Sample LoadGLB
Codeboy-cn Nov 14, 2023
7f23ef0
chore: Remove sample GraphicPath
Codeboy-cn Nov 14, 2023
74c4c7c
update public assets
lslzl3000 Nov 14, 2023
cfbb549
fix index import
lslzl3000 Nov 14, 2023
19ef288
fix: class name register error
Codeboy-cn Nov 14, 2023
04b1ca7
Merge branch 'dev-0.7.2-GraphicFace' of github.com:X-OldGentleMan/ori…
Codeboy-cn Nov 14, 2023
6f3bbe7
fix: Auto sort transparent renderers. (#318)
lslzl3000 Nov 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions packages/effect/grass/shader/GrassVertexAttributeShader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ export let GrassVertexAttributeShader: string = /*wgsl*/ `
}

struct VertexOutput {
@location(0) varying_UV0: vec2<f32>,
@location(1) varying_UV1: vec2<f32>,
@location(2) varying_ViewPos: vec4<f32>,
@location(3) varying_Clip: vec4<f32>,
@location(4) varying_WPos: vec4<f32>,
@location(5) varying_WNormal: vec3<f32>,
@location(6) varying_Color: vec4<f32>,
@location(0) index: f32,
@location(1) varying_UV0: vec2<f32>,
@location(2) varying_UV1: vec2<f32>,
@location(3) varying_ViewPos: vec4<f32>,
@location(4) varying_Clip: vec4<f32>,
@location(5) varying_WPos: vec4<f32>,
@location(6) varying_WNormal: vec3<f32>,
@location(7) varying_Color: vec4<f32>,
#if USE_SHADOWMAPING
@location(7) varying_ShadowPos: vec4<f32>,
@location(8) varying_ShadowPos: vec4<f32>,
#endif
@builtin(position) member: vec4<f32>
};
Expand Down
23 changes: 10 additions & 13 deletions samples/ext/Sample_Grass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ export class Sample_Grass {

Engine3D.startRenderView(this.view);

this.post = this.view.scene.addComponent(PostProcessingComponent);
let fxaa = this.post.addPost(FXAAPost);
let fog = this.post.addPost(GlobalFog);
fog.fogColor = new Color(136 / 255, 215 / 255, 236 / 255, 1);
fog.start = 0;
fog.overrideSkyFactor = 0.0764;
fog.ins = 1;
fog.falloff = 0.626;
fog.scatteringExponent = 3;
fog.dirHeightLine = 10;
// this.post = this.view.scene.addComponent(PostProcessingComponent);
// let fxaa = this.post.addPost(FXAAPost);
// let fog = this.post.addPost(GlobalFog);
// fog.fogColor = new Color(136 / 255, 215 / 255, 236 / 255, 1);
// fog.start = 0;
// fog.overrideSkyFactor = 0.0764;
// fog.ins = 1;
// fog.falloff = 0.626;
// fog.scatteringExponent = 3;
// fog.dirHeightLine = 10;
// post.addPost(TAAPost);

this.createScene(this.view.scene);
Expand Down Expand Up @@ -148,9 +148,6 @@ export class Sample_Grass {
// GUIHelp.addFolder("shadow");
// GUIHelp.add(Engine3D.setting.shadow, "shadowBound", 0.0, 3000, 0.0001);
// GUIHelp.endFolder();

let globalFog = this.post.getPost(GlobalFog);
// GUIUtil.renderFog(globalFog);
}

}
Expand Down
2 changes: 1 addition & 1 deletion samples/graphic/Sample_GraphicMeshWave.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, LitMaterial, MeshRenderer, BoxGeometry, SphereGeometry, VirtualTexture, GPUTextureFormat, UnLitMaterial, UnLitTexArrayMaterial, BitmapTexture2DArray, BitmapTexture2D, PlaneGeometry, Vector3, Graphic3DMesh, Matrix4, Time, BlendMode, PrefabParser } from "@orillusion/core";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, UnLitTexArrayMaterial, BitmapTexture2DArray, BitmapTexture2D, PlaneGeometry, Vector3, Graphic3DMesh, Matrix4, Time, BlendMode, PrefabParser } from "@orillusion/core";
import { GUIUtil } from "@samples/utils/GUIUtil";
import { Stats } from "@orillusion/stats";

Expand Down
2 changes: 1 addition & 1 deletion samples/graphic/Sample_GraphicMesh_0.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, LitMaterial, MeshRenderer, BoxGeometry, SphereGeometry, VirtualTexture, GPUTextureFormat, UnLitMaterial, UnLitTexArrayMaterial, BitmapTexture2DArray, BitmapTexture2D, PlaneGeometry, Vector3, Graphic3DMesh, Matrix4, Time, BlendMode } from "@orillusion/core";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, UnLitTexArrayMaterial, BitmapTexture2DArray, BitmapTexture2D, PlaneGeometry, Vector3, Graphic3DMesh, Matrix4, Time, BlendMode } from "@orillusion/core";
import { GUIUtil } from "@samples/utils/GUIUtil";
import { Stats } from "@orillusion/stats";

Expand Down
2 changes: 1 addition & 1 deletion samples/graphic/Sample_GraphicMesh_1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, LitMaterial, MeshRenderer, BoxGeometry, SphereGeometry, VirtualTexture, GPUTextureFormat, UnLitMaterial, UnLitTexArrayMaterial, BitmapTexture2DArray, BitmapTexture2D, PlaneGeometry, Vector3, Graphic3DMesh, Matrix4, Time, BlendMode, Color } from "@orillusion/core";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, UnLitTexArrayMaterial, BitmapTexture2DArray, BitmapTexture2D, PlaneGeometry, Vector3, Graphic3DMesh, Matrix4, Time, BlendMode, Color } from "@orillusion/core";
import { GUIUtil } from "@samples/utils/GUIUtil";
import { Stats } from "@orillusion/stats";

Expand Down
2 changes: 1 addition & 1 deletion samples/graphic/Sample_GraphicMesh_2.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, LitMaterial, MeshRenderer, BoxGeometry, SphereGeometry, VirtualTexture, GPUTextureFormat, UnLitMaterial, UnLitTexArrayMaterial, BitmapTexture2DArray, BitmapTexture2D, PlaneGeometry, Vector3, Graphic3DMesh, Matrix4, Time, BlendMode } from "@orillusion/core";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, UnLitTexArrayMaterial, BitmapTexture2DArray, BitmapTexture2D, PlaneGeometry, Vector3, Graphic3DMesh, Matrix4, Time, BlendMode } from "@orillusion/core";
import { GUIUtil } from "@samples/utils/GUIUtil";
import { Stats } from "@orillusion/stats";

Expand Down
2 changes: 1 addition & 1 deletion samples/graphic/Sample_GraphicMesh_3.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, LitMaterial, MeshRenderer, BoxGeometry, SphereGeometry, VirtualTexture, GPUTextureFormat, UnLitMaterial, UnLitTexArrayMaterial, BitmapTexture2DArray, BitmapTexture2D, PlaneGeometry, Vector3, Graphic3DMesh, Matrix4, Time, BlendMode, PrefabParser } from "@orillusion/core";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, MeshRenderer, UnLitTexArrayMaterial, BitmapTexture2DArray, Vector3, Graphic3DMesh, Matrix4, Time, PrefabParser } from "@orillusion/core";
import { GUIUtil } from "@samples/utils/GUIUtil";
import { Stats } from "@orillusion/stats";

Expand Down
163 changes: 163 additions & 0 deletions samples/graphic/Sample_GraphicPath.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, LitMaterial, MeshRenderer, BoxGeometry, SphereGeometry, VirtualTexture, GPUTextureFormat, UnLitMaterial, UnLitTexArrayMaterial, BitmapTexture2DArray, BitmapTexture2D, PlaneGeometry, Vector3, Graphic3DMesh, Matrix4, Time, BlendMode, Color, PostProcessingComponent, BloomPost, TrailGeometry, AnimationCurve, Keyframe, AnimationCurveT, KeyframeT, DepthOfFieldPost, Quaternion, PingPong, Object3DUtil, GPUPrimitiveTopology } from "@orillusion/core";
import { GUIUtil } from "@samples/utils/GUIUtil";
import { Stats } from "@orillusion/stats";

export class Sample_GraphicPath {
lightObj3D: Object3D;
scene: Scene3D;
parts: Object3D[];
width: number;
height: number;
cafe: number = 47;
frame: number = 16;
view: View3D;

colors: Color[];
trail3ds: Object3D[][];

constructor() { }

async run() {

Matrix4.maxCount = 300000;
Matrix4.allocCount = 300000;

await Engine3D.init({ beforeRender: () => this.update() });

Engine3D.setting.render.debug = true;
Engine3D.setting.shadow.shadowBound = 5;

this.colors = [];

GUIHelp.init();

this.scene = new Scene3D();
this.scene.addComponent(Stats);
let sky = this.scene.addComponent(AtmosphericComponent);
sky.enable = false;
let camera = CameraUtil.createCamera3DObject(this.scene);
camera.perspective(60, Engine3D.aspect, 1, 5000.0);

camera.object3D.addComponent(HoverCameraController).setCamera(30, 0, 120);

this.view = new View3D();
this.view.scene = this.scene;
this.view.camera = camera;

Engine3D.startRenderView(this.view);

GUIUtil.renderDebug();

// let post = this.scene.addComponent(PostProcessingComponent);
// let bloom = post.addPost(BloomPost);
// bloom.bloomIntensity = 1.0
// GUIUtil.renderBloom(bloom);

await this.initScene();

sky.relativeTransform = this.lightObj3D.transform;
}

async initScene() {
/******** light *******/
{
this.lightObj3D = new Object3D();
this.lightObj3D.rotationX = 21;
this.lightObj3D.rotationY = 108;
this.lightObj3D.rotationZ = 10;
let directLight = this.lightObj3D.addComponent(DirectLight);
directLight.lightColor = KelvinUtil.color_temperature_to_rgb(5355);
directLight.castShadow = false;
directLight.intensity = 10;
GUIUtil.renderDirLight(directLight);
this.scene.addChild(this.lightObj3D);
}


let texts = [];
texts.push(await Engine3D.res.loadTexture("textures/frame64.png") as BitmapTexture2D);
texts.push(await Engine3D.res.loadTexture("textures/line_001064.png") as BitmapTexture2D);

// texts.push(await Engine3D.res.loadTexture("particle/fx_a_fragment_003.png") as BitmapTexture2D);
// texts.push(await Engine3D.res.loadTexture("textures/grid.jpg") as BitmapTexture2D);
// texts.push(await Engine3D.res.loadTexture("textures/128/line_0001.PNG") as BitmapTexture2D);
// texts.push(await Engine3D.res.loadTexture("textures/128/line_0010.png") as BitmapTexture2D);
// texts.push(await Engine3D.res.loadTexture("textures/128/line_0013.png") as BitmapTexture2D);
// texts.push(await Engine3D.res.loadTexture("textures/128/line_0017.png") as BitmapTexture2D);

let bitmapTexture2DArray = new BitmapTexture2DArray(texts[0].width, texts[0].height, texts.length);
bitmapTexture2DArray.setTextures(texts);

let mat = new UnLitTexArrayMaterial();
mat.baseMap = bitmapTexture2DArray;
mat.name = "LitMaterial";

GUIHelp.add(this, "cafe", 0.0, 100.0);
GUIHelp.add(this, "frame", 0.0, 100.0);
{
this.width = 40;
this.height = 1;
let mr = Graphic3DMesh.drawRibbon("trail", this.scene, bitmapTexture2DArray, 255, this.width * this.height);
this.parts = mr.object3Ds;




mr.material.blendMode = BlendMode.SOFT_ADD;
mr.material.transparent = true;
// mr.material.doubleSide = true;
mr.material.depthWriteEnabled = false;
// mr.material.useBillboard = true;

for (let i = 0; i < this.width * this.height; i++) {
mr.setTextureID(i, Math.floor(Math.random() * texts.length));
// mr.setTextureID(i, 0);
}

let c1 = new Color(0.65, 0.1, 0.2, 0.15);
let c2 = new Color(1.0, 1.1, 0.2, 0.65);
this.colors.push(c2);
this.colors.push(c2);
this.colors.push(c2);
this.colors.push(c2);
this.colors.push(c2);
this.colors.push(c2);
}

this.updateOnce(1000);
}

private tmpArray: any[] = [];
update() {
this.updateOnce(Time.frame);
}

updateOnce(engineFrame: number) {
if (this.trail3ds && this.trail3ds.length > 0) {
// Vector3.HELP_0.x = Math.random() * 10 - 5;
// Vector3.HELP_0.y = Math.random() * 2 - 1;
// Vector3.HELP_0.z = Math.random() * 10 - 5;
Vector3.HELP_0.set(0, 0, 0);
// let offsetAngle = Math.random() * 360;
for (let i = 0; i < this.trail3ds.length; i++) {
const trail3d = this.trail3ds[i];
let offsetAngle = i * 2.0;

for (let j = 0; j < trail3d.length; j++) {
let p = j / (trail3d.length - 1);
trail3d[j].x = Math.sin(p * (trail3d.length / 15) + offsetAngle + engineFrame * 0.001) * p * 35 + Vector3.HELP_0.x;
trail3d[j].y = j * 0.2 + Vector3.HELP_0.y;
trail3d[j].z = Math.cos(p * (trail3d.length / 10) + offsetAngle + engineFrame * 0.001) * p * 35 + Vector3.HELP_0.z;

// let obj = Object3DUtil.GetSingleSphere(0.1, 1, 0, 0);
// this.scene.addChild(obj);
// obj.transform.x = trail3d[j].x;
// obj.transform.y = trail3d[j].y;
// obj.transform.z = trail3d[j].z;
}
}
}
}

}
Loading
Loading