GithubHelp home page GithubHelp logo

soft8soft / pyosl Goto Github PK

View Code? Open in Web Editor NEW
35.0 6.0 1.0 61 KB

OSL to GLSL converter

License: MIT License

Python 100.00%
osl glsl shader ply parser lexer converter verge3d translator opengl openshadinglanguage shading-language yacc grammar

pyosl's Introduction

OSL to GLSL converter

OSL to GLSL converter written in Python.

This library is an open-sourced component of Verge3D toolkit.

Usage

pyosl includes a command line utility called osl2glsl.py. The command

  python osl2glsl.py your_shader.osl

will print converted GLSL shader to stdout. Use the:

  python osl2glsl.py your_shader.osl > your_shader.glsl

command to write GLSL shader to the file named your_shader.glsl.

OSL standard library functions

Converter will try to use the built-in GLSL functions where possible. In all other cases it will rename OSL functions as follows:

  • noise -> oslNoise
  • transform -> oslTransform

It's up to you to write implementations of such oslNAME methods.

Support

Got questions/found bugs? Ask on the Verge3D Forums.

License

This tool is licensed under the terms of the MIT license.

pyosl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

motionguided

pyosl's Issues

AttributeError: module 'ast' has no attribute 'NodeVisitor'

I've tried to convert an OSL into a GLSL and I've got this output error below. The osl file you can find it here.

 python osl2glsl.py flakes.osl > flakes.glsl
Traceback (most recent call last):
  File "C:\Users\Rinaldi\Sources\pyosl\osl2glsl.py", line 7, in <module>
    import pyosl.glslgen, pyosl.oslparse
  File "C:\Users\Rinaldi\Sources\pyosl\..\pyosl\glslgen.py", line 3, in <module>
    import binascii, collections, inspect, os, re, sys
  File "C:\Users\Rinaldi\AppData\Local\Programs\Python\Python312\Lib\inspect.py", line 1036, in <module>
    class _ClassFinder(ast.NodeVisitor):
                       ^^^^^^^^^^^^^^^
AttributeError: module 'ast' has no attribute 'NodeVisitor'

Thanks.

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.