AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage

Transforms not working (everything is identity) in testshade --optix

Open
#1,264 4 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

Transforms don't appear to work in optix. I'm running the following shader through testshade:
```
surface test_add(output color Cout = 0) {
point Po = transform("myspace", vector(1, 1, 1));
if (u < 0.1 && v < 0.1) {
printf("Po = %f %f %f\n", Po.x, Po.y, Po.z);
}
Ci = diffuse(N) * color(Po) + emission() * u;
}
```
EDIT: I've just realised a my shader is passing a vector to transform() and expecting a point back again, which seems wrong. In any case, if I change that to point(1,1,1) instead of vector the behaviour on both CPU and GPU is unchanged.

**Expected behavior:**
This should print out:
```
Po = 1.0 0.5 1.0
```
and indeed it does when running on the CPU

**Actual behavior:**
Prints:
```
Po = 1.0 1.0 1.0
```
when running with --optix

### Steps to Reproduce

1. Compile the shader above
2. Run `testshade test_add --res 16 16`
3. Run `testshade test_add --res 16 16 --optix`

### Versions

* OSL branch/version: master 17a17191dfc
* OS: ubuntu 18.04
* C++ compiler: gcc-8.4
* LLVM version: 10.0.1
* OIIO version: 2.2.8
* CUDA version: 10.1
* OptiX version: 7.1

Contributor guide

Open the contributing guide

Research direction

Start with the testshade entry point and reproduce the shader using transform("myspace", point(1, 1, 1)) on CPU and with --optix. Trace why the OptiX result remains 1.0 1.0 1.0 instead of the CPU result 1.0 0.5 1.0, then verify the corrected behavior with the reported testshade commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.