AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage

texture function and unpremulted RGB output

Open
#1,917 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.3k
Forks
414
Avg merge
3d 1h
Merged PRs (30d)
10

Description

### Problem

As a 3ds max user I am going to describe an issue with OSL from a 3ds max perspective, but I have been told that the issue is not with the 3ds max implementation of OSL but the OSL system itself:

**Actual behavior:** In 3ds max, using OSL to read bitmaps will always produce premultiplied RGB channel output.

**Expected behavior:** There should be an argument controlling whether to premultipliy RGB channels or not.

Composing materials is very much like compositing in general, and many times you need the raw RGB output unaffected by the alpha. The OSL texture function should contain an argument whether to premultiply the RGB channels or leave them untouched (unpremulted).

### Steps to Reproduce

1. In 3ds max (any version containing OSL) create an OSL node that reads bitmaps (Bitmap Lookup, UberBitmap, etc).
2. Load a texture file that is clearly unpremultiplied.
3. Output only the RGB channels into another node and preview the output. The result is always premultiplied, meaning the RGB channels have been multiplied by the alpha even though you **only** expect the untouched RGB channels.

### Versions

Not sure about the version specifics here. All I know is that this issue exists in whatever version of OSL is used by 3ds max 2023, 2024 and 2025.

* OSL branch/version: n/a
* OS: n/a
* C++ compiler: n/a
* LLVM version: n/a
* OIIO version: n/a

Contributor guide

Open the contributing guide

Research direction

Start by tracing the OSL texture function and its handling of RGB and alpha values; the issue does not name implementation files or tests. Reproduce the behavior with a bitmap in 3ds Max, then define and verify an option that preserves unpremultiplied RGB output without breaking existing texture behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.