rainerpl

Members
  • Content Count

    19
  • Joined

  • Last visited

About rainerpl

  • Rank
    Member
  • Birthday 11/15/1987

Contact Methods

  • Website URL
    http://timetoargue.com

Profile Information

  • Gender
    Male
  • Location
    Estonia
  • Interests
    Coding

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks for the reply, Im not using v5, and upgrading is not an option for now. Any way to use the previous pixi version to do simple pixel level operations at reasonable FPS?
  2. Hi, Im trying to make a simple app/feature, that fills an area with random pixels(random color at random time) I have a working solution that is only a handful of lines of code, but its crazy slow. (uses WegGL and Nvidia GTX1060 gfx card + i7 cpu ). The way i fill the canvas with random pixels at the moment is like this: 1) set interval that calls the drawRandomPixels function( it struggles to draw 1 frame every 250 ms ) 2) loop over every pixel coordinate(x, y) and use this.contentGfx.fillColor = 0xFFFFFF * Math.random(); this.contentGfx.drawRect(x, y, 2, 2); 3) after all the pixels have been looped over, call the endFill() and render the stage. Very simple and basic, yet it has massively worse FPS than what i get when i play Battlefield 5 on highest settings. The area that im trying to fill is 250 x 250 canvas. I used 2x2 pixel size to get a bit better performance but its still damn awful. Is there a better way to draw pixels in PIXI ?
  3. Hi, Im fairly new to babylonjs. I need give meshes materials which alpha/color properties depend on the mesh'es location/distance/placement relative to each other( or some internal mesh property that is different for each mesh ) The scene setup is very simple. I have thousands of cubes( all sharing the same material ). Now, i want to make it so that the cube's alpha and color values depend on how close a mesh is to another mesh in the scene. This would create a dynamic range of alpha/color values which are always changing( as meshes change ). I know I could give each mesh its own material, but that would hit the performance( and i need the meshes to share almost all material properties except alpha/color ) Is there a way to share a material between thousands of meshes, but allow each mesh have its own alpha value ?
  4. I dont know this for sure, but i use blender's 0.0.0 coordinate in edit mode as mesh origin. Drag the mesh in edit mode so that the 0.0.0 is where you want the origin to be.
  5. Thanks for the replies. I was using point lights, and i was using a custom range, so light would attenuate and help to create more depth perception. Now im thinking of creating extra lights, 1 set with no attenuation, to consistently light the player, and other lights to light the scene. I read somewhere that its not recommended to use more than 8 lights or something. Is it better for performance if i use e.g 5 lights with includedOnlyMeshes array containing only 1 mesh, and then another 5 which apply to all meshes. ?
  6. I think it depends on the range and radius attributes. It does attenuate once distance is greater than range, but it seems up to that point...it remains constant
  7. Hi, I have a scene where a mesh has a light 10 units away from it with intensity of 1. Id like to know a formula/way of setting lights intensity to such a value, that when it is moved to 20 units away from the mesh, it would still light the mesh as intensely as before. Simply doubling the intensity value doesnt work.
  8. Thanks, Il try that tomorrow and if it works...thank allot funny thing is, i actually saw this "bake" function, but didnt know it bakes scaling.
  9. Hi, Id like to know, if its possible to scale object bigger by "n" times, then apply that scaling to mesh verts coordinates, and reset scaling back to 1. So mesh remains "n" times bigger, but mesh.scaling.x says its 1. ?
  10. Hi, I use scaling to make my gameobject "grow bigger", however i noticed it's having an unusual/weird effect on the camera that is a "child" of that object. ( camera.parent = my_gameobject) Basically objects will disappear into blind spots that appear. If scaling is very low, then everything disappears. I also noticed that scaling effects players position/translations even though it shouldnt( i think ). For example if i scale down my object 5 times, then it seems to move/traverse 5 times slower. What other effects does scaling have on a mesh/its children aside of scaling its geometry. Also how do i scale without messing up the camera, or what changes do i need to apply on camera to undo the scaling on its parent ?
  11. Hi, Is there a built in way to "lookAt" a point in 3D space, using only 2 coordinates( x and y ). I found a lookAt function from this forum, but that used 3 coordinates which screws up the camera and player orientation. Id like to keep my player's z rotation always at 0.
  12. I tried the matrix.getTranslation, but it returns exactly the same object that i can get using mesh.getWorldMatrix().getTranslation() seems to be same as mesh.position Im not sure how i can use it to get a point relative to the mesh. All changes to mesh.position are done in global space, not local. I could probably do something like this to get the point, but its a hack and id rather use a nicer solution. mesh.translate(BABYLON.Axis.Z, 2, BABYLON.Space.LOCAL); var relative_point = mesh.position.clone(); //move mesh back to undo the translation. mesh.translate(BABYLON.Axis.Z, -2, BABYLON.Space.LOCAL); /* Quick Update - I found a solution that works in my case. Below is what i used for future readers. */ relative_pos = player.calcMovePOV(0, 0, 10); world_matrix = player.getWorldMatrix(); world_translation = world_matrix.getTranslation(); world_obj.position = world_translation.add(relative_pos);
  13. Great, ill give it a try soon and see how it works. I was looking at the source code for: locallyTranslate=function(t){this.computeWorldMatrix(!0),this.position=e.Vector3.TransformCoordinates(t,this._localWorld)}, Looks like it does something similar, but yeah, i didnt know what "e" is was in the code, and whats the thing with ( !0 ) in compute matrix call.
  14. Hi, Im looking for a way to place objects relatively to other nested objects. ( objects that have a chain of parents that have been moved, rotated ). I searched the docs but couldnt find anything that could do what im looking for. Ive tried position.add / addToRef etc but they dont take object's rotation/parent chain into account. An example of what id like to do: A player turns 90 degrees in x direction. A weapon that is parented to the player, turns another "n" degrees. Now, how would i put a bullet at the tip of the weapon. ( without setting its parent = weapon ). After the bullet is created, it would move/follow objects in global space/coordinate system. in pseudo code: bullet = new Bullet();//extends Mesh. bullet.position = player.weapon.position.clone().translate(BABYLON.Axis.Z, weapon_barrel_length, BABYLON.Space.LOCAL); Note: position object doesn't have translate function, only mesh. My actual case is a bit different but this example explains it better.
  15. mesh.color = new BABYLON.Color3(1, 0, 0) This works, and assigns a color, but the lines/color is not shaded like it is when using wireframe material. Is there an option to enable shading ?