ok my bad - thanks
I ended up finding an error-free solution
Can you share the resource please to help others that may have run into this or similar issue?
Yes, but it will take at least a month, as it then will be part of a release (otherwise kind of entrepreneur classified etc) ⌠ps it is far from perfect for the moment, and I dont want to defend against comments on quality
You said that you âfoundâ an error free solution, why canât you share where you found it? Thatâs all Iâm really asking for.
The main idea of the community here is to not only post about issues and problems people have, but also share the solutions to build up a knowledge base and help others.
My first partial solution uses a glb-blender animation solution, which is quite non-code oriented.
Here is the second one (more code-like/dynamic)
var MoveBumpOffset = pc.createScript('moveBumpOffset');
// initialize code called once per entity
MoveBumpOffset.prototype.initialize = function() {
this.bump = 0.7; this.uvoffsetX= 0; this.uvoffsetY= 0;
this.upOrDwn =false; this.upOrDwn_time = 0;this.upOrDwn_Vaerdi =0.002;
};
// update code called every frame
MoveBumpOffset.prototype.update = function(dt) {
var app = this.app; var self = this; self.fr++;
var meshes = null; self.uvoffsetX+=dt.toFixed(4)/100;self.uvoffsetY+=dt.toFixed(4)/100;
if(self.bump<1 && self.upOrDwn===false){ self.bump+=dt.toFixed(4)/4;}
if(self.bump>0 && self.upOrDwn===true){ self.bump-=dt.toFixed(4)/4;}
if(self.bump>1 ){ self.upOrDwn=true;} else{
if(self.bump<0 ){ self.upOrDwn=false;}}
if(self.entity.model){meshes = self.entity.model.model.meshInstances;
for(var i=0; i<meshes.length; i++){
var mesh = meshes[i];
self.entity.model.model.meshInstances[i].material.bumpiness = this.bump;
self.entity.model.model.meshInstances[i].material.normalMapOffset.set(self.uvoffsetX, self.uvoffsetY);
self.entity.model.model.meshInstances[i].material.shininess = 92;
self.entity.model.model.meshInstances[i].material.update();
}
}
};
The material has to have a normal-map attached off course
Did you still use a shader or other techniques for reflection?
No, but if you re-read the whole thread you would not go in that direction either - at least when it comes to moving water. A repo-update set my project back, and I had to use all these âextraâ hours ⌠anyways the water reflection example (shader) had a resize error already, so it does not matter that mvaligursky and Lexxig did not answer. My solutions are free of errors and not dependent on the repo-change.
PS: Have to go now, and this last bumpwater-example is actually good enough to become a tutorial (the best moving water as I can see - but up to you admins )
Iâm happy to move it to the tutorials section but we would need a full project with the assets etc that just implements the water feature.
I havenât read the thread in details, but is there an issue with my project I should look into? I have just checked it and fixed some issues with RenderTarget, which was using an old API. Apart from that I donât seem to have any errors with it on resize.
@LeXXik I can confirm itâs working as expected. The same error I was getting in a project of mine seems to have been fixed with one of the recent engine releases.
@LeXXik @Leonidas One of my commits on 1.41.0 made a change on when the canvas width/height was resized and caused some projects to have issues/behave differently. It was backed out in 1.41.2 so there shouldnât be an issue anymore.
Iâve be re-adding the change for 1.42.0 (with fixes) and have tested against all the projects that have had the issue include your water reflection LeXXik.
ok, I will make a html+css-style of project with different kinds of user-options. Will call it âMoving Water Reflections - Bump map offsetâ (dont know if you @LeXXik, are interested in making a fully updated shader-project [âMoving Water Reflections - Shaderâ], otherwise I can include this/your, now fully functional, shader in a âMoving Water Reflectionsâ-project?)
You are free to fork it and use in your projects.