Coder Social home page Coder Social logo

Fix 32 bit rendering about open1560 HOT 15 CLOSED

0x1f9f1 avatar 0x1f9f1 commented on July 18, 2024
Fix 32 bit rendering

from open1560.

Comments (15)

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

Using -nomip helps to avoid a bug (unsure if caused by MM1 or dgVoodoo) where the pitch of a surface is half of what it should be (width * (bpp+7)/8)

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

agiD3DTexDef::BeginGfx calculates this->SurfaceSize = 2 * this->SurfaceDesc.dwWidth * this->SurfaceDesc.dwHeight though it is not clear if this field is used anywhere

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

agiDDPipeline::CopyBitmap expects a 16-bit frame buffer when agiCurState.State.PolyMode == 3

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

When some of the listed issues are hackily fixed, you are able to get in game, though there are still some graphical issues, mostly being broken reflections and traffic lights:
image

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

mmCullCity::UpdateSnowTextures supports 8-bit and 16-bit snow textures, though this is implemented as an if/else and as such defaults to treating the texture as 8-bit.

image

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

agiSurfaceDesc::Reload only supports annotating 8-bit and 16-bit textures, though this happens before textures are converted to 32-bit so it's not much of a problem

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

Using -depth -nomip and setting bAdditiveBlending=0 in video.cfg fixes the graphical issues:
image

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

Commit 910dad3 fixes -nomip being required with dgVoodoo by clearing the DDSD_PITCH flag before passing the DDSURFACEDESC2 to IDirectDraw4::CreateSurface. Because the DDSURFACEDESC2 was originally from a 16-bit image, and only the ddpfPixelFormat was overwritten, the pitch was incorrect. It seems native DDRAW doesn't trust this value, but dgVodooo does.

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

dxiScreenShot only supports 555 and 565 surfaces

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

Using bAdditiveBlending=1 and premultiplying the alpha in copyrow4444_to_8888 also (mostly) fixes the transparency issues.

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

Using premultipled alpha with copyrow4444_to_8888 causes certain textures to be darker/less visible. Most noticeably: Smoke, Rain and Snow (maybe all particles?).

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

With premultiplied alpha the reflections also seem to be over saturated (NOTE: This is only true for RV3, so it may just be a problem with those textures).
image
image

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

It looks like premultipled alpha should only be used with textures that have the "g" flag (in their tex sheet), though since that information isn't stored in the agiSurfaceDesc, it will likely require a rewrite of agiD3DTexDef::BeginGfx

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

467188a fixes texture conversion by passing agiTexParameters to agiSurfaceDesc::CopyFrom, allowing a check whether the surface needs to have the alpha premultiplied

from open1560.

0x1F9F1 avatar 0x1F9F1 commented on July 18, 2024

All 32-bit texture issues should be fixed at this point.

from open1560.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.