thrice

Members
  • Content count

    61
  • Joined

  • Last visited

Everything posted by thrice

  1. @Arte Don't click this if you have epilepsy (really), but: any example of passing variables to the shader to use as a discard threshold. https://playground.babylonjs.com/#AFUQKR A more practical example on cyos I was working on, I was trying to get a decent looking 2d smoke plane shader working, almost looks decent but not quite: http://cyos.babylonjs.com/#09CV0F-- Point is, I would imagine there is some way to pass the dimension of the sphere in the scene to the shader, and use the discard keyword to cutout the pixels that are not relevant. Whether by redrawing the sphere via the dimension in GSGL, or to recreate the area you want to discard, or what not. Although I'm barely able to understand building 2d shaders at this point, so I'm just the idea guy. I still haven't fully grasped the vertex shader side of things yet, and I'd imagine that would somehow be important as that seems to manipulate the shape. Also it looks like discard doesn't work w/ vertex shader, so IDK.
  2. Sorry for the title but I can't think of a better way to explain what is happening. Basically it's like there is some gravitational force on the left side of my screen, which is causing CERTAIN mesh calculations to appear incorrectly. I.E., my planes show up at the right place on screen, hover trigger actions fire as the mesh is entered by the mouse at the correct position. What isn't working is: renderOutline = true, along with children action planes which I dynamically display when the mesh is hovered on -- And as far as I can tell, whatever is causing renderOutline=true to show incorrectly, seems to be the same thing affecting the hovers. (also, dynamicEdgesRendering works fine, but render outline does not?) Much easier to show via screenshots: ^ Each card on board with renderOutline = true As you can see, as the meshes get closer to the left side of the screen, the further left the outline is pulled. ^ With enableEdgesRendering = true , calculation seems perfect here And finally, the dilemma. These are the hover planes I was talking about. Basically, when a card is hovered on, I pull out a plane which is parented to the card_on_board_plane, x_offset = card_on_board_plane.width - 0.5 (because I need to track when the actions plane is hovered on to keep it open, so it SHOULD be showing up just before the right edge of the plane) - So card #3 in the picture is unable to have its actions activated But the problem seems to apply to my scene as a while, i.e. - each card has a hover state (as you can see in last picture as well) - But even if I hover on a card which is in the players hand (I pull the hover states left of the absolute position of the card being hovered on), and that card is on the left side of the screen, the hover state gets pulled further left than if I hover on the right side of the screen. Given that renderOutline seems to be exposing the underlying issue (and enableEdgesRendering is showing dimensions being calculated perfectly), whatever it may be, I'm hoping there is a simple explanation for what I am seeing, or something dumb I am doing that is causing it. Anyone have any idea?'
  3. Transparency in Babylon gUI?

    Containers/controls have an alpha value you can set to < 1 for transparency
  4. I would think theoretically it would be possible to do using shader material / discard keyword, and passing a uniform into the shader with the spheres bounding info. I've done, much much simpler things, using a similar strategy (i.e. discard pixel if color.r < threshold, which I pass to shader). But maybe I'm missing something and/or don't know what the hell I'm talking about (probably both). (Actually, I guess in my situations, I was cutting out the shell of the object, there was no inner material as pictured. That seems much harder now that I think about it)
  5. Further illustration, this time, ignore the action planes and note the position of the large card hover being pulled to the left of the planes. ^ hovering on card #1, closer to the left of screen Hovering on card #3, right side of screen
  6. @Wingnut Ya visibility doesn't work either for a mesh with a shader material applied unfortunately. But no, I always appreciate the help regardless! Cool thanks Delta
  7. Quick question: Is there any way to fade out a ShaderMaterial'd mesh? mesh.material.alpha = X does not seem to have any affect on the alpha value, unless I am doing something wrong. Am I missing something or is it not possible? (I can probably fake it by adding an alpha uniform to the fragment shader and explicitly passing it in, however this would be painful to animate). Also, if I go the uniform route, I'm not sure how much overhead (if any), it adds, setting the uniform value for the shader before render. I've noticed a lot of games similar to mine (digital card games), will have their shader effects timed in sync for a particular effect, which led me to the assumption that there is probably a performance reason behind it? (because having the effects fire on a different start time would look better) - But maybe I'm way off mark with that assumption, anyone happen to know?
  8. Well, as far as I can tell, ShaderMaterial seems like a combination of material + texture, and I don't see a level property on the shader material? I only see alpha on the shader material, but setting the alpha to 0 doesn't seem to affect the shader material. And, I'm actually trying to fade out the entire mesh not just the effect
  9. So, I am having an issue with GUI controls / click through events when attaching to mesh. I'm not sure if this is technically a bug, or if there is a built in way to accomplish what I am trying to do which I am missing, so figured I'd ask here first before going to GH. Use case is: I have a card plane. When you hover the card plane, I have an actions plane (with advancedDynamicTexture) which appears above the card plane slightly, which contains multiple action buttons (which do not fill the plane, parts of the card are still visible) - Basically trying to make it so when the actions buttons are visible, you can click the button, without triggering the card planes action manager click actions, but if you click inbetween the actions, you are able to trigger the cards action manager. Example is here: https://www.babylonjs-playground.com/#6KVU7X Basically, if I set the actions plane to isPickable, can't click the plane behind it. If I set it to false, can't click the buttons. Is there an easy way to achieve this and or is this a bug? I am thinking maybe it would make sense to have a property on the dynamic texture itself which would default to the parent mesh, but then could be overwritten, to allow us to have: mesh.isPickable = false texture.isPickable = true and that distinction could allow click through on areas which are empty, while still allowing the buttons to be clicked? (unless there is some easy property setting I am missing or whatever).
  10. Nice! I think I need to familiarize myself with stack panel,, thought it was only part of the full screen api - that could simplify some of my code I think. however: the original objective I was trying to accomplish remains - Basically, in your example, it would be the equivalent of being able to click through to the plane, in the small portion of the stack panels that overlaps the plane behind it, that does not have a stack panel button in that space. But ya, I have it working the slightly more complicated way so not the end of the world, and design wise probably not the best UI doing it that way, but would have worked in this instance just because the buttons themselves aren't very tall so it's easy to click the plane behind it while hovered. P.S. Overflow handling/scrollbar would be amazing btw! Just throwing that out there @Deltakosh
  11. freezeWorldMatrix / children

    Word, good to know, thanks
  12. Quick question: Does freezeWorldMatrix need to be called on children meshes to gain full performance benefit, or is freezing a parent mesh enough (I see that the children have different values for isWorldMatrixFrozen, so guessing I need to freeze each child individually, but figured I'd make sure before making a bunch of changes that didn't need to be made) Also: Is there a way to measure how many meshes world matrices are being evaluated in the scene, i.e. something like engine.drawCalls for matrices calculations count?
  13. freezeWorldMatrix / children

    Appears to be affecting FPS quite a bit, much smoother after freezing children so assuming children need to be frozen individually
  14. @Wingnut Thanks for the reply. I actually don't disagree that in this case, it's a bit of a poor ui decision. Reason I did it that way was mainly simplicity. The better way would probably be to make the menu appear to the right or left of the mesh, however that brings a number of complications, i.e.: 1. I am showing a list of keywords to the left of the card, which leaves me showing it to the right of the card.If the board gets too full, the menu will be stretching beyond the bounds of the window (which I haven't solved yet) 2. I have to now offset the actions plane to be slightly within the parent plane, then when mouse enters the actions plane, store a variable on the actions plane to indicate that mouse is over the actual actions plane (otherwise hovering out of the main card plane would cause the actions plane to close) With all that said: I still think the behavior is surprising.
  15. @magigAhhh! Thanks a ton! This shader stuff is intense, still trying to wrap my brain around it.
  16. So, I'm trying to convert a shader from shadertoy, I'm close but still can't get it working. Also in my actual scene it doesn't seem to be working at all, but it's hard to tell if it's related to the issue I am having w conversion, since I need to rotate the sphere to get it to show up to begin with. Shader is here: (it appears blank at first, but if you rotate it youll start to see the fire. The actual effect I am going for you will see only if you rotate it just right so that you see the fire starting with the white in the middle, and it filling up the sphere). http://cyos.babylonjs.com/#M11GKA The source shader is here: https://www.shadertoy.com/view/lsf3RH So the one place I was not sure how to proceed, was mapping over the iResolution variable (which shadertoy states is the viewport resolution). I played around with a bunch of different things and ended up trying the camera input, which works, but requires rotating the mesh to see it at all. Anyone know what input would map over to viewport resolution (or how to get it), and or what I am doing wrong/missing here?
  17. I am trying to make my scene (card game) as performant as possible. I've made it quite a bit faster by using mesh instances and sharing them with cards and what not, but it seems like I am unable to use instances with a mesh which has a AdvancedDynamicTexture material/texture on it. Primary use case is each card has it's own separate attribute set, however the attributes appear all in the same location on the mesh. (i.e., card name, type, attack, health, cost, etc) I think it's actually just one draw call for the plane and an additional one for the texture, but still would be nice if it were possible. Am I missing something or is this currently not supported?
  18. Using mesh instances with Babylon GUI

    Ya I will when I have a chance: separately, I've been tracing down a pretty big bug in my local project with drawCalls multiplying on dispose for the past few nights. I think I figured out the cause, but can't reproduce on a PG, going to open bug on GH though.
  19. Thanks for the tips. I think the initial not seeing FPS improvement was also due to electron, which behaves really strange w babylon sometimes (like sometimes when scene is loading, fps will just tank to like 30 and never recover, until I minimize window and bring it back to the foreground). Anyways I'm down to 150ish draw calls now and seeing 50+ FPS for the first time in quite awhile!
  20. So I've been trying to improve performance in my scene. Been stuck at around 40fps consistently. I am making a card game, so there are a lot of planes, with a lot of materials (the images for the cards), as well as each card in hand / on board having its own set of attributes. Anyways, I was under the impression that scene.engine.drawCalls, was the number of things babylon would redraw, or check to see if it was dirty or whatever, everytime the render loop runs. Now I'm not so sure, because after reducing my draw calls from a minimum 350 when I load my scene, to 200, I haven't really seen a FPS boost. Before I continue to refactor to reduce the number of draw calls, I figured I would ask, am I missing something here? Or is that still a large number of draw calls, which could be causing or contributing to the low FPS?
  21. I can't reproduce it in a playground, so I am wondering if there is another setting, i.e. on the material itself that I am setting which could be contributing to the problem, or some other scene configuration that I am missing or whatever, anyways: Trying to set a bumpTexture on a material throws an error, with a huge chunk of WebGL code. Screenshot is easiest to see https://www.dropbox.com/s/c9ik0kmwl3zlscj/Screenshot 2017-06-30 15.48.15.png?dl=0 Full error message: https://gist.github.com/jasonayre/3f5aea25c5e09540f9e00f426211d808 Babylon version in my project (a couple of weeks agoish, maybe a few weeks ago?) babylonjs@^3.0.2-beta: version "3.0.2-beta" resolved "https://registry.yarnpkg.com/babylonjs/-/babylonjs-3.0.2-beta.tgz#a8fef0e6ee32ced2e158f00de6aa740e874f146a" diffuseTexture with the same asset works fine, bumpTexture blows up, i.e. this.plane.babylon.material.bumpTexture = BABYLON.Texture.CreateFromBase64String(this.backgroundNormalMap(), this.background_normal_map_image_key); ^throws error this.plane.babylon.material.diffuseTexture = BABYLON.Texture.CreateFromBase64String(this.backgroundNormalMap(), this.background_normal_map_image_key); ^no error -- any ideas as to what could be happening here?
  22. Looks like upgrading to babylonjs@3.0.4-beta fixed it
  23. Oh also, at the end of the error which throws the huge WebGL code block there is another error, not sure if this is helps identify or not client.js:111264 BJS - [16:34:06]: Error: WARNING: 0:81: ' ' : extension directive should occur before any non-preprocessor tokens ERROR: 0:743: 'NORMALXYSCALE' : unexpected token after conditional expression t._ErrorEnabled @ client.js:111264Effect._prepareEffect @ client.js:111274(anonymous function) @ client.js:111274Effect._processShaderConversion @ client.js:111274(anonymous function) @ client.js:111274Effect._processIncludes @ client.js:111274(anonymous function) @ client.js:111274Effect._loadFragmentShader @ client.js:111274(anonymous function) @ client.js:111274Effect._processShaderConversion @ client.js:111274(anonymous function) @ client.js:111274Effect._processIncludes @ client.js:111274(anonymous function) @ client.js:111274Effect._loadVertexShader @ client.js:111274Effect @ client.js:111274n.createEffect @ client.js:111266r.isReadyForSubMesh @ client.js:111277r.render @ client.js:111273t.render @ client.js:111274t.renderUnsorted @ client.js:111270t.render @ client.js:111269t.render @ client.js:111269r._renderForCamera @ client.js:111271r._processSubCameras @ client.js:111271r.render @ client.js:111271(anonymous function) @ client.js:134915n._renderLoop @ client.js:111265 client.js:111264 BJS - [16:34:06]: Trying next fallback.
  24. I.E., playing card with 2 sides. Not sure how to apply a material to the backside of a plane? I would think there must be support for this though, because of the fact that there is DEFAULTSIDE, FRONTSIDE, BACKSIDE, options right? Otherwise what is the point of having frontside backside?