Wagner
March 28, 2025, 12:33pm
1
When zooming in, the fps drops, while the number of displayed vertises does not change.
Device:
processor: Intel Core i5-11400
graphics card: Intel UHD Graphics 730
@mvaligursky Can you tell me what the problem might be?
It seems you should profile it, as this seems to be CPU issue - see the Update and Physics time going up significantly when you zoom out.
Wagner
March 28, 2025, 1:37pm
3
I turned off physics, the problem was there before, I just didn’t pay attention to it, because everything was fine on other devices.
hmm strange with those dropped frames.
we’ve seen something similar with our model viewer on android I think in some cases. No explanation at the moment. We’ll need to try and get to the bottom of it. It’s like the browser is blocked somewhere.
1 Like
@Wagner can you share the grass material? Thinking if it’s alpha blended and there is heavy overdraw, then most likely it’s a fillrate issue (overlapping geometry, even alpha tested only geometry can suffer from some overdraw).
Yes, I’ve seen similar issues with vegetation models on Android when getting close to a model.
I am not that well versed in these things, but aside from materials, could the actual model space an issue? If it is, maybe Draco might help.
Wagner
March 31, 2025, 7:37am
8
Hi Leonidas, I don’t use alpha blending.
import { getSamplerType, getTerrainHeightFactorVS, heightMapFactorsChunks, terrainHeightMapParamName, terrainMaxHeightParamName, terrainMinHeightParamName } from "../TerrainHelpers/TerrainPatchesShaderChunks.mjs";
import { THeightMapFormat } from "../TerrainSystem/AbsHeightMap.mjs";
export const vindexAttrName = "vertex_position";
export const offsetAttrName = "vertex_offset";
export const shapeAttrName = "vertex_shape";
export const timeParamName = "uTime";
export const offsetXZParamName = "uOffsetXZ";
export const offset2XZParamName = "uOffset2XZ";
export const drawPosParamName = "uDrawPosition";
export const windIntensityParamName = "uWindIntensity";
export const instancingVS = ``;
export const transformInstancingVS = ``;
export const transformDeclVS = ``;
export const definesVS = /** @type glsl */
`
precision highp float;
This file has been truncated. show original
import { BoundingBox } from "playcanvas";
import { GrassFieldTexture } from "../GrassFieldHelpers/GrassFieldTexture.mjs";
import { drawPosParamName, getGrassShaderChunks, offset2XZParamName, offsetAttrName, offsetXZParamName, shapeAttrName, timeParamName, vindexAttrName, windIntensityParamName } from "../GrassFieldHelpers/GrassShaderChunk.mjs";
import { drawBox } from "../Shared/Debug.mjs";
import Random from "../Shared/Random.mjs";
import { getHeightMapFormat } from "../TerrainHelpers/TerrainPatches.mjs";
import { terrainHeightMapParamName, terrainMaxHeightParamName, terrainMinHeightParamName } from "../TerrainHelpers/TerrainPatchesShaderChunks.mjs";
import BigTerrainEditor, { bigTerrainEditorScriptName } from "./BigTerrainEditor.mjs";
export interface IBufferStore {
// Indices for a blade
index: Uint16Array,
// Tells the shader which vertex of the blade its working on.
// Rather than supplying positions, they are computed from this vindex.
indexVerts: Float32Array,
// Shape properties of all blades
// Positon & rotation of all blades
This file has been truncated. show original
Pay attention to this fragment, maybe I’m doing it wrong:
data: this._bufferStore.indexVerts,
storage: false,
});
}
private _updateMeshMaterial(graphicsDevice: pcx.GraphicsDevice) {
this._material?.destroy();
this._material = new pc.StandardMaterial();
this._material.name = "GrassFieldMaterial";
this._material.blendType = pc.BLEND_NONE;
const terrain = this._terrainEditor.terrain;
const patches = this._terrainEditor.terrainRenderPreparer.patchesStore;
const heightMap = patches.heightMapTexture;
this._material.setAttribute(vindexAttrName, pc.SEMANTIC_POSITION);
this._material.setAttribute(offsetAttrName, pc.SEMANTIC_ATTR10);
this._material.setAttribute(shapeAttrName, pc.SEMANTIC_ATTR11);
this._material.setParameter('uDataMap', this._dataTexture.texture);
Wagner
March 31, 2025, 9:44am
9
Yes, something strange, even if you activate shadows, etc., the fps does not drop so much…