GithubHelp home page GithubHelp logo

rgb8bit's Introduction

rgb8bit

This mod provides a new color palette for use with hardware coloring in Minetest. 256 colors are specified from a combination of 3-bit red values, 3-bit green values, and 2-bit blue values. Helper functions are provided to quantize your RGB values given a value range.

Credit

Prof. Paul Pickell (University of British Columbia) implemented the palettes in 8-bit (256 colors) as an installable mod for Minetest.

Install the palettes

Unpackage the rgb8bit folder into your mod directory, located where ever you installed Minetest.

Use

rgb8bit utilizes hardware coloring and supports passing a param2 value to a rgb8bit node. The mod only registers the 8-bit palette, which is meant to be used in conjunction with RGB values that will color the node with other mods.

Example using 8-bit RGB values quantized with a range of 0 to 255

-- Quantize RGB values
local red = rgb8bit.map_value_to_3_bits(input_red_value, 0, 255)
local green = rgb8bit.map_value_to_3_bits(input_green_value, 0, 255)
local blue = rgb8bit.map_value_to_2_bits(input_blue_value, 0, 255)

-- Get the index of the color from the palette
local color_index = rgb8bit.get_palette_index_from_rgb(red, green, blue)

-- Write the quantized values to the param2 value and assign the rgb8bit node to the data
data[vi] = minetest.get_content_id("rgb8bit:rgb8bit")
param2[vi] = color_index

rgb8bit's People

Contributors

pauldpickell avatar

Watchers

 avatar

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.