www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: xujiang on October 25, 2013, 06:26:19 pm

Title: Octree and camera problems
Post by: xujiang on October 25, 2013, 06:26:19 pm
Hello, excuse me . There was no correlation Liezi OcTree control range of Camera rendering
Title: Re: Octree and camera problems
Post by: EgonOlsen on October 25, 2013, 06:49:31 pm
What?... ???
Title: Re: Octree and camera problems
Post by: xujiang on October 25, 2013, 06:58:04 pm
The visible range rendering model   .............There are no related tutorials
Title: Re: Octree and camera problems
Post by: xujiang on October 25, 2013, 07:00:52 pm
Scene segmentation related materials 
Title: Re: Octree and camera problems
Post by: EgonOlsen on October 25, 2013, 08:27:30 pm
Sorry, i still don't get the question. You can create an octree if you feel that it's needed. You can use it for rendering and/or collision detection. It has nothing to do with the camera. So what's the actual question? When and why to use it?
Title: Re: Octree and camera problems
Post by: xujiang on October 26, 2013, 05:13:21 pm
I need to make a big scene with OcTree control within sight of model rendering, outside the field of view does not render. But I did not find the relevant information, will have to provide reference information related to you?
Title: Re: Octree and camera problems
Post by: EgonOlsen on October 27, 2013, 07:32:46 pm
Creating an octree basically goes like this:

Code: [Select]
obj.build();
...
OcTree occy=new OcTree(obj, 1000, OcTree.MODE_OPTIMIZED); // Or a different value than 1000
occy.setCollisionUse(true); // Or false if you want to
occy.setRenderingUse(true); // Or false if you want to
obj.setOcTree(occy);

Is that what you are looking for?
Title: Re: Octree and camera problems
Post by: xujiang on October 28, 2013, 05:53:42 am
Thank you, you send the code is  exactly what I need, and I also need the code of  rendering control, used to control the render scene in the field of vision scope, outside of the visual field is not been  rendered. some relevant example is ok
Title: Re: Octree and camera problems
Post by: EgonOlsen on October 28, 2013, 07:29:05 am
Anything outside of the fov won't the rendered anyway. That's one purpose of a 3d engine, there's nothing to code for that. It happens automatically.
Title: Re: Octree and camera problems
Post by: xujiang on October 28, 2013, 08:07:46 am
The engine system default has put the inside of the visual field rendering,not rendering outside the field of vision ?
Just need to set the  (Config.maxPolysVisible = 3000;)?  and don't have to write other algorithms to implement ?
Title: Re: Octree and camera problems
Post by: EgonOlsen on October 28, 2013, 07:50:17 pm
Objects will be culled when outside the fov and so will be octree nodes (if octrees are used).
Title: Re: Octree and camera problems
Post by: xujiang on October 31, 2013, 05:27:27 am
Ask a model can be provided with a plurality of texture?
Title: Re: Octree and camera problems
Post by: EgonOlsen on October 31, 2013, 07:35:04 am
You mean multi texturing? Yes, the engine supports this. But the file format like obj and 3ds don't, so you have to apply the additional layers in code or by splitting the models before exporting them or...
Title: Re: Octree and camera problems
Post by: xujiang on October 31, 2013, 07:45:58 am
Need a reference code? Also need a particle effects of reference materials
Title: Re: Octree and camera problems
Post by: EgonOlsen on October 31, 2013, 08:36:56 pm
I'm sorry, but i can't give "reference code" for everything. There are examples, there's a wiki and there are Javadocs. If you have specific questions, feel free to ask them here but i can't provide you with a silver bullet that solves all problems. For multi texturing, have a look at the TextureInfo class.
Title: Re: Octree and camera problems
Post by: AGP on November 01, 2013, 05:16:39 am
Egon, you are a saint for decoding this. Does it help to know Germain? :- )
Title: Re: Octree and camera problems
Post by: EgonOlsen on November 01, 2013, 07:30:30 am
Egon, you are a saint for decoding this. Does it help to know Germain? :- )
No, i don't think so... ;)
Title: Re: Octree and camera problems
Post by: xujiang on November 28, 2013, 06:38:18 pm
Excuse me, can display text?
Title: Re: Octree and camera problems
Post by: EgonOlsen on November 29, 2013, 08:23:18 am
http://www.jpct.net/forum2/index.php/topic,1074.0.html (http://www.jpct.net/forum2/index.php/topic,1074.0.html)
Title: Re: Octree and camera problems
Post by: xujiang on December 01, 2013, 05:26:59 pm
Screen flicker ,How to solve? The following code



private Canvas canvas = null;
...

buffer = new FrameBuffer(GanmeConfig.WIDTH, GanmeConfig.HEIGHT, FrameBuffer.SAMPLINGMODE_NORMAL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL, IRenderer.MODE_OPENGL);

canvas = buffer.enableGLCanvasRenderer();
canvas.setBounds(0, 0, GanmeConfig.WIDTH, GanmeConfig.HEIGHT);
frame.add(canvas);

...
while(flag){
....
   buffer.clear();
   sh.updateShadowMap();
   sh.drawScene();
   skybox.render(world, buffer);
   buffer.clearZBufferOnly();
   world.renderScene(buffer);
   world.draw(buffer);
   buffer.update();
   buffer.displayGLOnly();
   //////////////////
   canvas.repaint(); 
   Thread.sleep(14);
   }
   buffer.dispose();
   frame.dispose();
Title: Re: Octree and camera problems
Post by: EgonOlsen on December 01, 2013, 07:20:40 pm
You have two renderers active with this setup. They to leave out the enableRenderer for the GLRenderer to see if that helps.
Apart from that, i don't get your render loop...why are you using drawScene in the ShadowHelper and in addition, you are also rendering the world itself? That doesn't make any sense exception if the ShadowHelper uses a different world. If not, this is just wrong...
Title: Re: Octree and camera problems
Post by: xujiang on December 02, 2013, 10:15:16 am
 To solve the canvas flicker?  Canvas double buffer?
Title: Re: Octree and camera problems
Post by: EgonOlsen on December 02, 2013, 03:55:58 pm
I don't think so. Just have a look at the AWTGL example what comes with the distribution. Apart from that, you seem to ignore my former post, which contains some ideas on how to fix this.
Title: Re: Octree and camera problems
Post by: xujiang on December 02, 2013, 04:20:42 pm
Please provide reference URL
Title: Re: Octree and camera problems
Post by: xujiang on December 02, 2013, 04:28:21 pm
I want to use the OpenGL window, but many controls need to write their own. For example, I need a text input China text whether to support the input method?
Title: Re: Octree and camera problems
Post by: xujiang on December 02, 2013, 04:33:09 pm
(http://b.zol-img.com.cn/soft/6/328/ce2ThDYP5CFE.jpg)
Title: Re: Octree and camera problems
Post by: EgonOlsen on December 02, 2013, 05:33:20 pm
Please provide reference URL
Reference to what? The example that i mentioned can be found in the jpct.zip.
Title: Re: Octree and camera problems
Post by: xujiang on December 02, 2013, 05:51:46 pm
To solve the canvas flashing Liezi
Title: Re: Octree and camera problems
Post by: EgonOlsen on December 03, 2013, 07:41:53 am
As said: There's an example in the distribution that doesn't flicker. You can build upon that and see what's wrong with your code. And i mentioned that your render loop is most likely wrong. I don't see how i'm supposed to provide a kind of "reference url" to anything... ???