Forum Replies Created
-
AuthorPosts
-
Not as yet – the skybox is currently implemented by a simple quad+custom shader.
Shouldn’t the roughness affect how “blurry” the environment seems?
The ‘roughness’ controls which miplevel of the env cubemap is fetched when doing the reflection effect – higher roughness=blurrier mipmap used. But I agree your highlight looks wrong – there should probably be some filtering going on, it looks a bit too ‘binary’ to me.
There are other complications though. There’s no easy way to tell what miplevel the GPU would pick (which I need to know too) so that gets encoded in the cubemap alpha channel. But even then, GPU can apparently pick a mip level<0, but I have no way of knowing if it did as it gets clamped to 0. So there’s some dodgy add/sub hackery going on around that which affects output at the limits of ‘roughness’, some of which may just not be solvable in plain gles20 glsl.
Can you post the exact code you used to get your result?
Had a bit more of a play with this, and you can indeed disable the ambient specular lighting like this:
Monkey1234Local pixmap:=New Pixmap( 4,3 )pixmap.Clear( Color.Black )Scene.GetCurrent().EnvTexture=New Texture( pixmap,TextureFlags.Cubemap )This creates a 1×1 black cubemap and assigns it to the scene’s EnvTexture (not SkyTexture, my bad).
This will disable specular env reflections too though, pretty much as if you taped black paper over the windows (not recommended)!
The scene Terrain stack is internal and may yet change – using Entity.Destroy() is the correct way to remove something from a scene (assuming it works!).
There are many internal/experimental features like this. When in doubt, consult the docs, all the internal stuff should be hidden.
It’s probably about time to add a real ‘Internal’ directive to the language…
FFS, I’m making a lot of rookie mistakes lately I’m just about ready to quit coding forever…
Well, it’s not like any of this is particularly well docced!
Just added this to tests!
The easiest way to go is to create an array of vertices and an array of indices and just use New Mesh( vertices,triangles ).
Also, have a look at the source code for Mesh.CreateBox, Mesh.CreateSphere etc in modules/mojo3d/graphics/meshprims.monkey2
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283#Import "<std>"#Import "<mojo>"#Import "<mojo3d>"Using std..Using mojo..Using mojo3d..Class MyWindow Extends WindowField _scene:SceneField _camera:CameraField _light:LightField _model:ModelMethod New()'get scene'_scene=Scene.GetCurrent()'create camera'_camera=New Camera_camera.Near=.1_camera.Far=100_camera.Move( 0,0,-5 )'create light'_light=New Light_light.RotateX( Pi/2 ) 'aim directional light downwards - Pi/2=90 degrees.'create quad mesh'Local vertices:=New Vertex3f[4]vertices[0].position=New Vec3f( -1, 1,0 )vertices[1].position=New Vec3f( 1, 1,0 )vertices[2].position=New Vec3f( 1,-1,0 )vertices[3].position=New Vec3f( -1,-1,0 )Local indices:=New UInt[6]indices[0]=0indices[1]=1indices[2]=2indices[3]=0indices[4]=2indices[5]=3Local mesh:=New Mesh( vertices,indices )'create model for the mesh'_model=New Model_model.Mesh=mesh_model.Material=New PbrMaterial( Color.Red )_model.Material.CullMode=CullMode.NoneEndMethod OnRender( canvas:Canvas ) OverrideRequestRender()_model.RotateY( .1 )_scene.Render( canvas,_camera )canvas.DrawText( "Width="+Width+", Height="+Height+", FPS="+App.FPS,0,0 )EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndLooks very quake-y, love it!
> “Attempt to invoke method on null instance”
Ah yes, this is new to 1.1.05. It used to be you could invoke a (non-virtual) method on a ‘null’ object, but this is now caught by the debugger at runtime, eg:
Monkey1234567891011Class CMethod Test()Print "Here!"EndEndFunction Main()Local c:C=Nullc.Test()EndThis *used* to be allowed in monkey2, but in 1.1.05 and later you will get the above error.
The debugger *should* show you where it’s happening?
Had me going for a while, but the main problem here is that pixmaps are not cleared by default.
Add a pm.Clear( Color.Black ) after the New Pixmap(…).
This is due to the default SkyTexture, which effectively ’emits’ light (so SkyTexture is really kind of an ‘ambient specular’ map). The material’s specular reflection factor here is derived from its metalness, but this is never quite 0 because everything is shiny:
http://filmicworlds.com/blog/everything-is-shiny/
http://filmicworlds.com/blog/everything-has-fresnel/There are at least a couple of solutions here: you could use a ‘black’ SkyTexture which would totally eliminate any ‘ambient specular’ component (and totally eliminate any specular reflection effects – like in a completely dark room). I guess I could also add an ‘AmbientSpecular’ factor too that you could set to Black to do the same thing.
But I suspect what you really want is a custom type of non-pbr material that can be fudged however you want, without elimintaing specular reflections from the entire scene? I will probably be doing something like this myself soon as not everyone wants ‘realistic’ PBR style lighting – lots of people will no doubt just want matte/old school materials.
Also, I need a *better* default SkyTexture – the current one is too obviously a ‘sky/desert’ scene! If anyone has anything (in skybox format…) please let me know. I think a plain color gradient from sky to dirt might look best, but in skybox format.
This is when you use methods in a class and using no class variables(I think) It needs you to change the reported methods to functions.
Can you post an example of this?
This’ll be due to the deferred renderer ‘thrashing’ without any vsync – since it always renders to a texture, rendering never ‘fails’ the way it would if it was rendering to a window. Will fix.
…also, each Model has a ‘default material’ property called Model.Material. This is used if there aren’t enough materials in the model’s Materials array to render the mesh with, so is very convenient if you just want to render a mesh with a single material etc, ie: just use Model.Material instead of Model.Materials.
Use Mesh.AddMaterials( count:Int ) to add materials to a mesh, and use the ‘materialid’ parameter (defaults to 0) of Mesh.AddTriangles() to add triangles to a particular material.
A mesh starts with one material (with id=0), so first material you add will have id=1, next will have id=2 etc.
But meshes don’t actually store physical material instances, just the triangles assigned to each material ‘id’. Materials are actually stored in the Model entity (that also stores the mesh) via the Model.Materials property.
So the basic idea is:
Monkey123456789101112Local mesh:=New MeshMesh.AddVertices(...) 'verticesmesh.AddMaterials( 3 ) 'mesh now has 4 materials (starts with 1).Mesh.AddTriangles(...,0 ) 'add triangles to material 0Mesh.AddTriangles(...,1 ) 'add triangles to material 1Mesh.AddTriangles(...,2 ) 'add triangles to material 2Mesh.AddTriangles(...,3 ) 'add triangles to material 3Local model:=new Modelmodel.Mesh=meshmodel.Materials=New Material[](...) 'want 4 materials here...Also, any chance you can send me the (quake?) mesh you’re using?
Can’t spend any time on this right now, just collecting info…
It looks like a shadows issue to me, but there’s currently no way to turn them off. Also, the shadow technique used is designed for large scale outdoors scenes and will not work too well indoors (but it should still work…).
A lot of the flickering on the indoor scene is likely to be due to the fact the light is pointing straight down so is ‘grazing’ the vertically oriented walls which is resulting in numerical ‘epsilon’ problems. Try rotating the light a little bit! There are various fudge factors that can help with these problems, but I haven’t explored them much. I will make them easier to play with in the next release.
There is still a LOT of work to do so don’t expect too much at this point. It all works well on *my* machines, but there is a lot of different 3d hardware around and it wont work the same on everyone’s. My guess would be your depth textures have a lower precision than mine, which, if true, means you *will* get lower quality shadows, but of course things shouldn’t flicker like crazy.
Quick idea: you can disable shadows for now by changing ‘float shadow=evalShadow();’ to ‘float shadow=1.0;’ in modules/mojo3d/graphics/shaders/directional-light.glsl. Can you try this and post another screenshot, preferably from above, looking down on the scene? Since light is pointing down (and there’s no global illumination!) an ‘underneath’ shot is only showing ambient lighting.
-
AuthorPosts