Jump to content


  • Content Count

  • Joined

  • Last visited

  1. @thrice Thanks for all your input Yea I was going for a fog of war effect, I am actually doing the calculation on the vertex shader, and passing it down to the fragment shader. Never heard of custom render targets I guess that's something I could look into.
  2. @thrice The sphere is a mesh, the ground is a separate mesh (height map), then there is a custom mesh on top of both of them ( https://playground.babylonjs.com/#KDUJ4Z like this, except using the material to set the opacity ) which is where the shader does it's work, I pass the shader the location of the sphere (and all objects like it) along with their radius of influence, using a float array (i.e [obj1.x,obj1.z,radius,obj2.x,obj2.z,radius,...]) for a lack of a better way of passing the data. I had been doing the computation on the cpu but wanted to move it to the gpu side to reduce
  3. Basically something like what the OP of this question was trying to do https://stackoverflow.com/questions/2740874/how-do-i-get-the-current-color-of-a-fragment (I couldn't really get an answer that I understood from this either)
  4. @thrice Thanks for the quick response The event in this case is local to that part of the mesh and is calculated by passing an array of objects_positions into the shader I wanted to retain the values calculated by the previous render because calculating them again seems inefficient (as I'd need to pass in old values & new values, then do the calculation for both, which still doesn't achieve what I want to do as it gets rid of the calculations done before the immediately last one). For example in the pictures below I wan there to be slow transition between the co
  5. Hi all, I was wondering if it was possible to access variables from a previous pass in the shader, i.e color of fragment or something along those lines. I want to have something that changes color over time after an event occurs. So if I can access a time delta plus a previous color then I can slowly modify it to a new state, is this possible? *Note this is my first time working with shaders, please excuse any stupid questions 😕 Thanks.
  6. After the links that renjianfeng sent me(thanks ) I did end up splitting up the mesh into sub meshes, which did improve the cpu usage issue, but I don't think I could use Occlusion Queries on the sub-meshs. Also if any of you have an idea as the what would be the best number of sub-meshs to have that would be great (number of vertices per sub mesh ?) I did notice something odd though it seems that the cpu usage is high on Macs[running OS X 10.12.6] (with it idling around 30-40% of one core) while they are kept relatively low(I saw it idling at 1.9% O.o) on windows machines,
  7. Thanks Will have a look when I get back (heading out now). I've already tried with octrees (I maybe doing it wrong) but it didn't seem to help all that much. I could try putting up a playground, if that'd help. Thank you for pointing me to this
  8. what do you mean by bounce? Do you mean when it hits the ground you want to it to bounce or do you mean you want it to be projected to a certain height and then fall back down?
  9. Hi, I am trying to render a large custom mesh (with 256^2 vertices) and have that over the map, and adjust vertex transparency to implement FOW(Fog Of War), I've noticed that the cpu usage goes way up when I load the large mesh, I thought that it wouldn't impact the cpu usage much as a sizable part of the mesh isn't on screen. This leaves me with a couple options: 1. I could split the mesh into smaller chunks and load them as needed (seems difficult, and I'm not sure if it'll even work?) 2. Reduce number of vertices on the mesh (but this would leave me with low resol
  10. Thank you soooo much ! I thought I had hit a dead end at this point and I was beginning to lose hope I even considered individual meshes which I could adjust transparency for but I couldn’t get them lined up such the their seems wouldn’t interfere with one another resulting in dark lines, I got a sub optimal solution with shadow maps and CSG but I knew that wasn’t the way to go. (I didnt seem to see that last bit on the docs :/) Thanks for making Babylon btw
  11. I can't seem to get a custom-mesh transparent by altering the alpha values on the color vertex data I've even tried flipping the normals but nothing seems to work :`( here is the play-ground : http://playground.babylonjs.com/#0MJ7M4 Thanks
  • Create New...