Graphic issue with showing Cubes on Grid

I indeed subdevided the boxes and it works! Now if I have like “normal” boxes though (Box(20, 5, 10)) it’s a mess… But easy enough problem to fix! Thanks again, everyone! :smiley:

you dont need create new boxes for subdivide, you just need to have subdivided box mesh (you can do it yourself via code, or via Blender or in any other tool)

its just about “too big faces”, so you need make box of “smaller faces” instead of “very big faces”

or like others said, simply scale everything that might help too.

1 Like

This is your issue.

The Z-buffer does not have the resolution necessary to prevent z-fighting in the sub-20 pixel range. It has to somehow fit 2 million resolution in 16 bits.

Set this smaller and your z-fighting issue will go away.

1 Like

wow, i did not noticed it, i just seen scale solutions dont even looking at code :joy:

@Joutaro why you use for everything so big values? ;p i belive you thought frustrumFar is something different. you wanted to make it see much distant geoms? or why?

when now i think for your box scales its not that big, but belive me, overall scale would be good.

for example 100 of your units = 1 game unit.

so just make rootNode.scale(0.01f); (if its allowed for rootNode, if not then do subnode)

I…Actually I don’t know :joy: I did this like… 3 months ago when I started to use JME for the first time and was still learning stuff! :upside_down_face: Never thought that this could be the issue though! But I understand now! :laughing:

Well, generally should not be issues.

but there are… :grinning:

if you want make it proper. make 1 meter = 1 game unit. then most things should be fine, even when you will add physics or other things. (with default world params of gravity)

so just stick to 1 meter = 1 unit(0.1 meter = 0.1f unit) and all should be fine. If you dont know what is meter in your models, then just scale it down to make it proper.

well, too low values also might cause issue like “accuracy issue” because float can have certain amount of numbers after comma too. (but i never had issues like this, even when i had character 1.8 meters height, so hand finger like 0.0something, no issues, i just mean, do not try overscale it too ;p)

I also find setting the near plane less that 0.1 causes shadow issues.

are you sure?

    float scale = 0.01f;
    app.getCamera().setFrustumNear(1f*scale);

and i have no shadow issues

I scaled everything down! Different example (more like it is supposed to look like), but no eye-killing flickering anymore!!!


Thanks so much again! Now I have time for the other 2 big issues I need to fix… :rofl:

new topics? :joy: or maybe stick with this one?

btw. you might also want add some filters / antialiasing / etc

Can I stick with this one? Like I said, I’m not used to using a forum… Not sure if you guys can help me though…

it would be more proper with new topics,

but if its something quick to solve, i belive it can be here.
(but first we need to know what issue is)

btw. you also have Discord that is like chat, so can solve quick issues there.

ThenI’ll try one issue. The other will take waaay too much time to explain…
(And I can’t use Discord at work :joy:)

It’s about the first camera I used. Right now I’m moving the camera, but my supervisor wants me to move the SG not the camera. So I need to somehow attach the camera to the SG.

SG = scene graph?

Yup.

I don’t really understand this FocusCamera stuff right now…

i dont see problem. you just move all Node.

lets say you do:

Node myNode = new Node();
rootNode.attachChild(myNode);
// you add your boxes/etc all to your myNode
myNode.setLocalTranslation(Vector3f location you need)

to explain you further, SG have Spatials, where Spatial can be Node or Geometry or Line or whatever.

Node is like container of subelements. it can scale itself(so all its contents too) move it,etc. all its tranforms like rotations/locations/etc are affected.

here is nice link:
https://wiki.jmonkeyengine.org/jme3/scenegraph_for_dummies.html

Tried it already. Seems like it doesn’t work with the focusCamera though…

edit:

  • see below, i think you mean CameraNode, but you also might want to look at JME Store example.

as i know there were already some FocusCamera appstate(idk if you mean ChaseCamera too?)

or you can look at JME Store:
https://store.jmonkeyengine.org/8ac019eb-7e06-420d-8832-7858c6d3ddeb

you can look at the code how it was done here, and do own fork of it if need. or just use it.

So I need to somehow attach the camera to the SG.

Generally there is something like “CameraNode”

Also for further issues, i suggest you:

  • open SDK
  • create new project
  • select JME Tests
  • run it, see all tests and check their code
  • there should be cameraNode test too

Okay. Ooooookay. Ok. I can work with this!
Thanks again so much oxplay2!
If I get stuck again, I’ll create a new topic :laughing: I want to experiment with this first!