Page 2 of 3

Re: 2D: Faster way to roll an image?

Posted: Wed Jul 03, 2024 8:29 am
by dige
Thx pf_shadoko,

I have saved your code and an original 360 degree photo under the link above ( http://u.pc.cd/mvx7 )
saved.
Unfortunately, Ogre or the technology doesn't seem to be able to handle higher resolution images.
LoadTexture(0,GetFilePart(image)) failed. Tested with PB 6.11 x64.

The image resolution is: 11.904x5.592 pixel.

My goal would be to be able to process the actual panorama images that are composed from drone photos.
These have a resolution of 20.192 x 10.096 pixels.

Kind regards

Dige

Re: 2D: Faster way to roll an image?

Posted: Wed Jul 03, 2024 8:43 am
by wilbert
dige wrote: Wed Jul 03, 2024 8:29 am My goal would be to be able to process the actual panorama images that are composed from drone photos.
These have a resolution of 20.192 x 10.096 pixels.
The code below ignores direction for now and is hardcoded to 'down'.
The purpose is so you can test if the approach with DrawigBuffer would be of any help to you.
If it does help, up, left and right can be added as well.

Code: Select all

Procedure RollImage (ImgID, direction, offset)
  If StartDrawing(ImageOutput(ImgID))
    *db = DrawingBuffer()
    pitch = DrawingBufferPitch()
    po = pitch * offset
    *m = AllocateMemory(po, #PB_Memory_NoClear)
    CopyMemory(*db, *m, po)
    MoveMemory(*db + po, *db, pitch * (OutputHeight() - offset))
    CopyMemory(*m, *db + pitch * (OutputHeight() - offset), po)
    FreeMemory(*m)
    StopDrawing()
  EndIf
EndProcedure

Re: 2D: Faster way to roll an image?

Posted: Wed Jul 03, 2024 11:08 am
by BarryG
@dige: Is the full path to the image being specified?

Re: 2D: Faster way to roll an image?

Posted: Wed Jul 03, 2024 1:00 pm
by dige
BarryG wrote: Wed Jul 03, 2024 11:08 am @dige: Is the full path to the image being specified?
Yes. It runs fine with the './Pano_360.jpg', but not with './Insta360_X4_Smaple_image.jpg'

Re: 2D: Faster way to roll an image?

Posted: Wed Jul 03, 2024 1:01 pm
by dige
wilbert wrote: Wed Jul 03, 2024 8:43 am The code below ignores direction for now and is hardcoded to 'down'.
The purpose is so you can test if the approach with DrawigBuffer would be of any help to you.
If it does help, up, left and right can be added as well.
[..]
Well done wilbert! Your code seems to be 4x times faster! Thank you very much :D

Re: 2D: Faster way to roll an image?

Posted: Wed Jul 03, 2024 2:49 pm
by wilbert
dige wrote: Wed Jul 03, 2024 1:01 pm Well done wilbert! Your code seems to be 4x times faster!
That's good to know. :)

Would all directions (horizontal, vertical, diagonal) be equally important and used for you big 20.192 x 10.096 pixel images ?
What would be the minimum and maximum offset values you intend to use ?

Re: 2D: Faster way to roll an image?

Posted: Wed Jul 03, 2024 2:57 pm
by pf shadoko
it's not a problem related to the 3d PB (ogre): in my case, your 11904 X 5952 image works fine.
it must be linked to the graphics circuit

I've modified the code to support zooming (with mousewheel)

Code: Select all

InitEngine3D():InitSprite():InitKeyboard():InitMouse()

ExamineDesktops()
OpenWindow(0, 0,0, DesktopWidth(0)*0.8,DesktopHeight(0)*0.8, "CreateShader - [Esc] quit",#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0), 0, 0, 0)

image.s="C:\Users\Guillot\Downloads\Insta360_X4_Smaple_image.jpg"
If FileSize(image)<0:MessageRequester("!", "enter 360 panoramic image path (above)"):CallDebugger:EndIf
Add3DArchive(GetPathPart(image), #PB_3DArchive_FileSystem):Parse3DScripts()
LoadTexture(0,GetFilePart(image))

CreateCamera(0, 0, 0, 100, 100):MoveCamera(0,0,3,-6):CameraLookAt(0,0,0,0)
CreateMaterial(0,TextureID(0))
DisableMaterialLighting(0,1)
MaterialCullingMode(0,#PB_Material_AntiClockWiseCull)
MaterialFilteringMode(0,#PB_Material_Anisotropic)
CreateSphere(0,1000,64,64)
CreateEntity(0,MeshID(0),MaterialID(0))

Define.f MouseX,Mousey,fov=45

Repeat
	While WindowEvent():Wend
	ExamineKeyboard()
	ExamineMouse()
	MouseX = -MouseDeltaX() *  0.05
	MouseY = -MouseDeltaY() *  0.05
	FOV-MouseWheel()*5:If fov<10:fov=10:ElseIf fov>90:fov=90:EndIf
	CameraFOV(0,fov)
	RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)	
	RenderWorld()
	FlipBuffers()    
Until KeyboardReleased(#PB_Key_Escape) Or MouseButton(3)

Re: 2D: Faster way to roll an image?

Posted: Wed Jul 03, 2024 3:12 pm
by Caronte3D
Perfect! 8)

Re: 2D: Faster way to roll an image?

Posted: Wed Jul 03, 2024 4:00 pm
by Fred
I can confirm it works perfectly here as well with the big pic (a bit slow to start though) on a very old gfx card and it looks fantastic !

Re: 2D: Faster way to roll an image?

Posted: Thu Jul 04, 2024 8:43 am
by dige
Fred wrote: Wed Jul 03, 2024 4:00 pm I can confirm it works perfectly here as well with the big pic (a bit slow to start though) on a very old gfx card and it looks fantastic !
Oh what a pity that it doesn't work here :-( I feel like I've been excluded from the party :cry:

Can you please tell me under which conditions you got the big picture for viewing?

PB version?, x64 / x86? Debugger on / off? Compiled?
Windows version?

I habe Windows 10, Intel i7-6700, NVIDIA FX 580, 24GB RAM

Tested with PB 6.11 x64/x84 - LoadTexture () allways failed :?


Update:

I have gradually reduced the size of the image by 1000 pixels.
But at a size of 8,000 x 4,000 I got this error

NVIDIA OpenGL Driver
An application has requested more GPLI memory than is available in the system.
The application will now be closed.
Error Code: 6
Would you like to visit
http://nvidia.custhelp.com/app,'answers ... Va_id/3553 for help?

With 7.000 x 3.500 it works, but that is unfortunately far from the required B-size of approx. 20,000 pixels.

Re: 2D: Faster way to roll an image?

Posted: Thu Jul 04, 2024 8:51 am
by Caronte3D
You must edit the following line with the path and name of your jpg file:

Code: Select all

image.s="C:\Users\Guillot\Downloads\Insta360_X4_Smaple_image.jpg"

Re: 2D: Faster way to roll an image?

Posted: Thu Jul 04, 2024 9:01 am
by dige
Caronte3D wrote: Thu Jul 04, 2024 8:51 am You must edit the following line with the path and name of your jpg file:

Code: Select all

image.s="C:\Users\Guillot\Downloads\Insta360_X4_Smaple_image.jpg"
Thank you for your help.
But the path is correct, otherwise the check in line 10 would also fail:

Code: Select all

10 : If FileSize(image)<0:MessageRequester("!", "enter 360 panoramic image path (above)"):CallDebugger:EndIf

Re: 2D: Faster way to roll an image?

Posted: Thu Jul 04, 2024 9:12 am
by HeX0R
dige wrote: Thu Jul 04, 2024 8:43 am I habe Windows 10, Intel i7-6700, NVIDIA FX 580, 24GB RAM
Wow, you are using a 15 year old graphic card with just 512MB?
It might be time to invest a few € in something more up to date.

Re: 2D: Faster way to roll an image?

Posted: Thu Jul 04, 2024 9:38 am
by Fred
Of course 512 MB is history for GFX cards, no wonder it doesn't work..

Re: 2D: Faster way to roll an image?

Posted: Thu Jul 04, 2024 9:42 am
by dige
HeX0R wrote: Thu Jul 04, 2024 9:12 am Wow, you are using a 15 year old graphic card with just 512MB?
Yes, maybe a bit old and no longer suitable for gaming, but so far sufficient for me and I guess, still better than onboard graphics. :wink:

But I'm just wondering what Fred meant by a "very old gfx card" 🤔
Fred wrote: Wed Jul 03, 2024 4:00 pm I can confirm it works perfectly here as well with the big pic (a bit slow to start though) on a very old gfx card and it looks fantastic !