News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

this would be nice to develop to 3d floormapping

Started by daydreamer, May 09, 2013, 03:59:28 AM

Previous topic - Next topic

Siekmanski

Creative coders use backward thinking techniques as a strategy.

daydreamer

Quote from: Siekmanski on May 21, 2013, 06:54:07 AM
Hi guys

Here are some D3D9 heigthmap examples without using the D3DX9 library.
Bitmaps are embedded.

Press F1 to toggle Fullscreen.

1. BMP of 64 by 64 with 4096 color vertices and 7938 polygons.
2. BMP of 128 by 128 with 16384 color vertices and 32258 polygons.
3. BMP of 256 by 256 with 65536 color vertices and 130050 polygons.

Had a lot of visitors at my house this weekend, so better late than never hahahaha....
I'll clean up my source code this week and post them.

@Dave, hope you wanted something like this.
I have no trouble running this on a 1.6ghz centrino duo laptop with ATI x1600 mobile
maybe you should check for hardware CAPS and if no hardware support use software instead
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

Siekmanski

I do so in my code, but Dave's videocard seems to be a special case....  ;)
Creative coders use backward thinking techniques as a strategy.

FORTRANS

Hi,

    Ran the program in Reply #52 on an XP machine and it looks
good.  It did not run (well) on the Win2k machine.

Regards,

Steve N.

Siekmanski

Hi guys

@FORTRANS
Can you tell me a bit more about; "It did not run (well) on the Win2k machine."

@Dave
found this text in the DirectX SDK:

"Be careful if your hardware supports pixel processing (transforms and lighting) but does not support vertex processing.
If device doesn't support HW T&L or doesn't support 1.1 vertex shaders in HW, then switch to SWVP."

Hope this solves your vertex processing issue.

Here is the "BehaviorFlags" code to control the device creation:


    mov         eax,d3dcaps.DevCaps
    test        eax,D3DDEVCAPS_HWTRANSFORMANDLIGHT
    .if (eax != 0)
        test        eax,D3DDEVCAPS_PUREDEVICE
        .if (eax != 0)
            mov         ecx,D3DCREATE_HARDWARE_VERTEXPROCESSING or D3DCREATE_PUREDEVICE
        .else
            mov         ecx,D3DCREATE_HARDWARE_VERTEXPROCESSING
        .endif
    .else
        mov         ecx,D3DCREATE_SOFTWARE_VERTEXPROCESSING
    .endif

    mov         eax,d3dcaps.VertexShaderVersion
    .if (eax < D3DVS_VERSION(1,1))
        mov         ecx,D3DCREATE_SOFTWARE_VERTEXPROCESSING
    .endif

    .if (m_MultiThreaded)
        or          ecx,D3DCREATE_MULTITHREADED
    .endif


    coinvoke    g_pD3D,IDirect3D9,CreateDevice,m_D3DAdapter,m_D3DDevType,hwnd,ecx,addr d3dpp,addr g_pD3DDevice
    if_FAILED
        return  E_FAIL
    .endif


Here are the D3D9 heigthmap examples with this piece of code.

Press F1 to toggle Fullscreen.

1. BMP of 32 by 32 with 1024 color vertices and 1922 polygons.
2. BMP of 64 by 64 with 4096 color vertices and 7938 polygons.
3. BMP of 128 by 128 with 16384 color vertices and 32258 polygons.
4. BMP of 256 by 256 with 65536 color vertices and 130050 polygons.
Creative coders use backward thinking techniques as a strategy.

MichaelW

On my Windows XP SP3, P4 Northwood, NVIDIA GeForce FX5200 system
D3D9_DaveHM2 runs fine, D3D9x3Dtext has a problem with a missing MSVCRT70.DLL, and all of the
D3D9_DaveHM3 apps run fine.
Well Microsoft, here's another nice mess you've gotten us into.

dedndave

they run pretty well here, Marinus   :t

the 256 version has a problem where the top of the image flickers as it rotates
it's as though part of the image is cropped off for every other rotation frame

therwise, they are great images

i have been thinking about ways to do this without using direct3d
i.e., straight code   :P
there are a few "camera" examples out there to look at
but, i was trying to figure out how it works by myself - lol

EDIT: one thing these 3-d images are showing me is that i also need to work on a best curve interpolation
linear interpolation just doesn't cut it   :P

FORTRANS

Quote from: Siekmanski on May 21, 2013, 11:23:31 PM
Hi guys

@FORTRANS
Can you tell me a bit more about; "It did not run (well) on the Win2k machine."

Hi,

   Okay, ran it three times, and got three results.

   First time from a from a command prompt in a window.  A
window showed up, but it showed the screen background.  Which
stayed unchanged when I moved it around.  I hit escape and it went
away.  That prompted my comment.

   Second time to retry things, I started it from a command line in a
full screen session.  (Had one open.)  Popup that said "CheckDeviceType:
Not available on this graphicscard, changing settings now...".  Clicking
that brought up "Unable to create Direct3D Object".  Clicked that and
nothing else happened.

   Third time as the first from a windowed command prompt.  And
a window showed up containing the background.  I hit F1 to see
what would happen.  The mouse pointer went away, the CPU went
100%, got to the Windows Task Manager, but it was unresponsive,
and I had to reboot.

HTH,

Steve N.

Siekmanski

Hi MichaelW

D3D9x3Dtext uses the D3DX9 library and needs a lot of other dll's.
You get a bloated exe that only runs on the machines that have the right version of DirectX installed.

The D3D9.lib is present on all PC's

Thats why I don't use the D3DX9 library anymore and write my own routines for the math functions and the texture loading etc.

So keeping my exes small and hopefully running on every PC.

@Dave

That's a lot of work, rotation matrices, sorting, backface culling, clipping etc.
But it's fun to do.
Been there on the Amiga programming Demos.

You can have look at spline or hermite interpolation.

@FORTRANS

Thanks, but don't have a clue why they don't run.  :(
Creative coders use backward thinking techniques as a strategy.

Siekmanski

Creative coders use backward thinking techniques as a strategy.

dedndave

oh great !
thanks, Marinus
i see you added the D3DMathSSE2 inc/lib   :t

many thanks for all your help, guys

qWord

Quote from: Siekmanski on May 22, 2013, 01:05:00 AMD3D9x3Dtext uses the D3DX9 library and needs a lot of other dll's.
You get a bloated exe that only runs on the machines that have the right version of DirectX installed.
I think that is the reason why all DX software come up with their own customized DX installation.
If I'm not wrong, the whole installation files would have a size of 3.3MB for my above example.
MREAL macros - when you need floating point arithmetic while assembling!

daydreamer

I think win2k might be too old for dx9c or whatever version you have targeted marinus
Also gonna share cubic, quintic, cosine interpolation code which can be used more than for perlin noise
Marinus what about add a rocky bumpmap to the terrain.?
With fast memoryspeed why not make use of a system memory zbuffer for software rendering?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

dedndave

yes - Jochen mentioned something like 48 mb
but, i think the redistributable install would be much smaller

for interpolation, i am thinking of deriving a simple integer strategy using conic sections (circle, elipse, parabola)
between each data point pair, i can find a center, initial delta, and delta-delta
that should be fairly fast and provide reasonable results
no need for a bunch of floating point math when there are only 256 colors and 21 interpolated points   :P

dedndave

i installed the d3d sdk
part of it is a folder of redistrib files
that folder is ~93 mb
but i think it only installs a small part of that, based on which video card you have   :P