I hope this is some ogre3d optimization engine xD

Everything related to 3D programming
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 772
Joined: Fri Dec 04, 2015 9:26 pm

I hope this is some ogre3d optimization engine xD

Post by skinkairewalker »

Guys, has anyone noticed this? In the 3D engine, there is a kind of jaggedness, I don't know what it is, but it makes the graphics look "messy" depending on how the player rotates the camera or the angle he looks at.
I hope it's some ogre mechanism for optimization xD.

Can anyone else notice this or am I just going crazy?

screenshot1 : https://i.imgur.com/GQPDuUF.png
screenshot2 : https://i.imgur.com/JJzkRrD.png
video 1 : https://i.imgur.com/oobS7dE.mp4
miso
Enthusiast
Enthusiast
Posts: 407
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: I hope this is some ogre3d optimization engine xD

Post by miso »

That's called mipmapping. The faraway things are textured with a lower resolution texture (auto generated). It can be switched off in the material properties, but then your textures will be pixelated, and the faraway barely visible entities will be textured with full size textures. ( that slows down your program )

Edit: No, I can't touch the mipmapping system, can't be turned off... That's a con. Would be nice to get access to this as well. Filtering is available, try trilinear.
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: I hope this is some ogre3d optimization engine xD

Post by DarkDragon »

You can turn mipmapping off in the material script.

https://ogrecave.github.io/ogre/api/1.1 ... ml#texture
(numMipMaps)

However, mipmapping is used to reduce aliasing artifacts. It's not just a speed thing.
bye,
Daniel
miso
Enthusiast
Enthusiast
Posts: 407
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: I hope this is some ogre3d optimization engine xD

Post by miso »

I only use code to create materials...
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: I hope this is some ogre3d optimization engine xD

Post by DarkDragon »

miso wrote: Tue Feb 11, 2025 5:42 am I only use code to create materials...
Material scripts are code. Checkmate! :mrgreen:
bye,
Daniel
miso
Enthusiast
Enthusiast
Posts: 407
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: I hope this is some ogre3d optimization engine xD

Post by miso »

You know how I meant it ;)
pjay
Enthusiast
Enthusiast
Posts: 251
Joined: Thu Mar 30, 2006 11:14 am

Re: I hope this is some ogre3d optimization engine xD

Post by pjay »

Mipmaps are more responsible for texture reduction the smaller they need to be displayed, so I think it's actually the texture filtering options you need to look at - ensure Anisotropic filtering is enabled using MaterialFilteringMode(), and set it to a high level (x8 or x16) if you can.
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 772
Joined: Fri Dec 04, 2015 9:26 pm

Re: I hope this is some ogre3d optimization engine xD

Post by skinkairewalker »

Hello guys, thank you very much for sharing your knowledge, I added these 2 lines to the code directly

Code: Select all

ExamineDesktops():dx=DesktopWidth(0)*0.8:dy=DesktopHeight(0)*0.8
OpenWindow(0, 0,0, DesktopUnscaledX(dx),DesktopUnscaledY(dy), "Billboard - [Esc] quit",#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, dx, dy, 0, 0, 0)


Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Scripts", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Packs/skybox.zip", #PB_3DArchive_Zip)
Parse3DScripts()
; HERE >>>>>
AntialiasingMode(#PB_AntialiasingMode_x6)
MaterialFilteringMode(#PB_Default,#PB_Material_Trilinear,16)
and added this to the material,
Examples.Material

Code: Select all

material Examples/TudorHouse
{
	technique
	{
		pass
		{
			texture_unit
			{
				texture fw12b.jpg
				tex_address_mode clamp
				filtering trilinear
                max_anisotropy 16
				num_mipmaps unlimited
			}
		}
	}
}


but it still looks weird, every time I move the camera, it seems like a layer of blur is being added
miso
Enthusiast
Enthusiast
Posts: 407
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: I hope this is some ogre3d optimization engine xD

Post by miso »

I think I know what you mean now. It's not texture filtering, but some kind of motion blur like aftereffect on the camera when you turn it. More visible with major movements...
pjay
Enthusiast
Enthusiast
Posts: 251
Joined: Thu Mar 30, 2006 11:14 am

Re: I hope this is some ogre3d optimization engine xD

Post by pjay »

pjay wrote: Tue Feb 11, 2025 7:59 am ... ensure Anisotropic filtering is enabled using MaterialFilteringMode(), and set it to a high level (x8 or x16) if you can.
You've set Trilinear filtering in your sample.

Code: Select all

If InitEngine3D()
  
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)

  InitSprite() : InitKeyboard() : InitMouse()
  OpenWindow(0,0,0,800,600,"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
  OpenWindowedScreen(WindowID(0),0,0,800 * DesktopResolutionX(),600 * DesktopResolutionY())

  CreateMaterial(0, LoadTexture(0, "fw12b.jpg"))
  MaterialFilteringMode(0,#PB_Material_Anisotropic,16)
  CreateCube(0, 50) : CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, 0)
  
  CreateCamera(0, 0, 0, 100, 100) 
  MoveCamera(0, 30, 0, 70, #PB_Absolute)
  CameraBackColor(0, RGB(0,10,20))
  AmbientColor(RGB(255, 255, 255))
  LoadFont(0,"Segoe UI",15)
  
  CreateImage(1,200,40) : StartDrawing(ImageOutput(1)) : DrawingFont(FontID(0)) : DrawText(0,0,"<- Trilinear",255) : StopDrawing() : *mem = EncodeImage(1) : CatchSprite(0,*mem)
  CreateImage(1,200,40) : StartDrawing(ImageOutput(1)) : DrawingFont(FontID(0)) : DrawText(0,0,"<- Anisotropic",RGB(0,255,0)) : StopDrawing() : *mem = EncodeImage(1) : CatchSprite(1,*mem)
  FreeMemory(*mem) : LastMode = 99
    
  Repeat
    Repeat : Event = WindowEvent() : If event = #PB_Event_CloseWindow : Quit = 1 : EndIf : Until WindowEvent() = 0
    ExamineMouse() : ExamineKeyboard()
    
    Mode = ((ElapsedMilliseconds() / 2000) % 2)
    If Mode <> LastMode : LastMode = Mode
      Select Mode
          Case 0 : MaterialFilteringMode(0,#PB_Material_Trilinear) : OnSprite = 0
          Case 1 : MaterialFilteringMode(0,#PB_Material_Anisotropic,16) : OnSprite = 1
      EndSelect
    EndIf
    RenderWorld() 
    DisplaySprite(OnSprite,370 * DesktopResolutionX(),250 * DesktopResolutionX())
    FlipBuffers()
  Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 772
Joined: Fri Dec 04, 2015 9:26 pm

Re: I hope this is some ogre3d optimization engine xD

Post by skinkairewalker »

Thanks by example :D

creating the texture manually with:

Code: Select all

CreateMaterial(0, LoadTexture(0, "fw12b.jpg"))
MaterialFilteringMode(0,#PB_Material_Anisotropic,16)

; Add house
MeshHouse = LoadMesh(#PB_Any, "tudorhouse.mesh")
House = CreateEntity(#PB_Any, MeshID(MeshHouse), MaterialID(0), 0, 280, 0)
ScaleEntity(House, 0.5, 0.5, 0.5)
works fine !!

but applying these parameters to the material:

Code: Select all

material Examples/TudorHouse
{
	technique
	{
		pass
		{
			texture_unit
			{
				 texture fw12b.jpg
                tex_address_mode clamp
                filtering anisotropic
                max_anisotropy 16
                num_mipmaps -1
			}
		}
	}
}

apparently they are being ignored xD
Post Reply