Giter Site home page Giter Site logo

mta-cube-renderer's Introduction

MTA-Cube-Renderer

❒ renderer by borsuczyna

What is cube renderer?

cube renderer is open source custom rendering for Multi Theft Auto, you can feel free to contribute to it!

Is it finished?

No, it's almost finished, it requires timecyc hours to be added and it will be ready to use!

What's left?

  • Timecyc
  • dxDrawMaterialLine3D
  • dxDrawPrimitive3D
  • dxDrawLine3D

Special thanks

Ren712, Einheit-101

Custom shaders

  1. Create your .fx file inside effects
  2. Add it inside meta.xml
local mainShader = getMainShader()
shader = createShader('data/effects/your name.fx')
mainShader:remove('your texture name')
shader:apply('your texture name')

Custom shaders compiler

Keywords

::loop(variable name, int start, int stop)
// what to do
::end

::Includes
// what to include
::end

::Variables
// your variables
::end

::VSInput
// vsinput sementics
::end

::PSInput
// psinput sementics
::end

::WorldPosition(float4 worldPos)
// affect world position (shadows too)
::end

::VertexShader
// all vertex shader code
::end

::PixelShader(float4 texel)
// pixel shader
::end

::Emmisive(float4 emmisive)
// emmisive affect code
::end

Example wind shader:

::Includes
#include "data/include/noise.fx"
::end

::Variables
float Time;
float2 fWindDirection = float2(1, -1);
float fWindStrength = 3;
float fWindSpeed = 2;
float fWindNoiseSize = 0.5;
float fTreeZOffset = 0;
float fTreeHeight = 14;
bool isTreeLog = false;
::end

::WorldPosition(float3 worldPos)
float time = Time%%10000;
float2 windPosition = time * fWindSpeed * float2(-fWindDirection.x, -fWindDirection.y) + worldPos.xy / 10;
float2 windPositionSmall = time * 5 * max(1, fWindSpeed/3) * float2(fWindDirection.x, -fWindDirection.y) + worldPos.xy * 5;
float noise = perlinNoise(windPosition * fWindNoiseSize);
float noiseSmall = perlinNoise(windPositionSmall * fWindNoiseSize);
float treeHeight = max((VS.Position.z - fTreeZOffset)/fTreeHeight, 0);
float2 smallWind = fWindDirection * fWindStrength * noiseSmall * treeHeight / 3;
worldPos.xy += fWindDirection * fWindStrength * treeHeight * noise + (isTreeLog ? 0 : smallWind);
::end

Support server:

https://discord.gg/5djHMPfGGR

Preview

mta-cube-renderer's People

Contributors

borsuczyna avatar

Stargazers

 avatar Danila Danishevskii avatar  avatar AlexRazor avatar Sándor Király avatar  avatar Nurupo avatar XueZhang avatar  avatar  avatar Mustafa Resul KEL avatar  avatar Lamar avatar Fernando Rocha 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.