Home › Forums › Graphics / Maya › Generating procedural noise in V3d
Tagged: noise, procedural, Shader, shading, texture map, texturing
- This topic has 5 replies, 3 voices, and was last updated 1 month, 1 week ago by
Alexander Kovelenov.
-
AuthorPosts
-
2021-02-03 at 1:40 pm #38021
Muhammad Ebrahim
CustomerHi guys
this might be a noob question, but how can you make a procedural noise with the noise node not yet supported in Verge3D for Maya? I tried the OSL but it doesn’t seem to work on iOS
-
This topic was modified 2 months, 1 week ago by
Muhammad Ebrahim.
-
This topic was modified 2 months ago by
Muhammad Ebrahim.
2021-02-09 at 12:42 pm #38261Mikhail Luzyanin
StaffUnfortunally, there’s no procedural noises supported for Maya yet.
Co-founder and lead graphics specialist at Soft8Soft.
2021-02-09 at 6:22 pm #38292Alexander Kovelenov
Staff2021-02-10 at 12:56 pm #38344Muhammad Ebrahim
CustomerThis one, It’s the 3ds Max’s osl noise
2021-02-10 at 12:57 pm #38345Muhammad Ebrahim
Customerweired… it doesn’t want to upload the file
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475// General Noise Shader, returning a float (1D)// Noise.osl by Zap Andersson// Modified: 2019-11-26// Copyright 2019 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txtshader Noise[[ string help="A shader for generating more advanced noise" ]](point UVW = transform("object", P)[[ string help = "The UVW coordinate to use. When not connected, defaults to Object space" ]],float Scale = 25.0,string Type = "uperlin"[[ string widget= "popup",string help = "Use perlin, uperlin, cell, hash, simplex or gabor",string options="perlin|uperlin|cell|hash|simplex|gabor" ]],int Octaves = 4[[ string help = "Hos many layers of noise are mixed together" ]],float Lacunarity = 2.0[[ string help = "How much the 'frequency' of the noise changes per layer" ]],float Gain = 0.5[[ string help = "How much the amplitude of the noise changes per layer. Higher numbers means higher noise frequencies have more effect." ]],int StepFunction = 1[[ string widget= "checkBox",string label = "Step Function",string help = "Enables a per-layer smoothstep curve in the noise, allowing you to increase the 'contrast' of the noise" ]],float LowStep = 0.5[[ string help = "Low threshold of the smoothstep function.",string label = "Low Step",float min = -1.0, float max = 1.0 ]],float HiStep = 0.8[[ string help = "High threshold of the smoothstep function.",string label = "High Step",float min = -1.0, float max = 1.0 ]],int Normalize = 1[[ string widget= "checkBox",string help = "If the noise is auto-normalized to Amplitude or not." ]],float Amplitude = 1.0[[ string help = "The amplitude of the noise." ]],float Phase = 0.0[[ string help = "The 'Phase' is just a 4th coordinate of the noise, can be used to allow it to evolve over time, for example." ]],output float Out = 0,){point pnt = UVW / Scale;float sum = 0;float curFreq = 1.0;float curAmp = Amplitude;// Loop over number of octavesfor (int i = 0; i < Octaves; i++){// Compute a noise valuefloat ns = noise(Type, pnt * curFreq, Phase + i);if (StepFunction)ns = smoothstep(LowStep, HiStep, ns);// Add our result to the outputOut += ns * curAmp;// Add the amplitude to the normalizing sumsum += curAmp;// Step up frequency and amplitudecurFreq *= Lacunarity;curAmp *= Gain;}if (Normalize)Out /= sum / Amplitude;}-
This reply was modified 2 months ago by
Muhammad Ebrahim.
2021-03-08 at 9:10 am #39208Alexander Kovelenov
StaffHi,
WebGL 1.0 (which is the only version supported on iOS devices now) can’t handle loops with non-constant comparisons. Try this code instead:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475// General Noise Shader, returning a float (1D)// Noise.osl by Zap Andersson// Modified: 2019-11-26// Copyright 2019 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txtshader Noise[[ string help="A shader for generating more advanced noise" ]](point UVW = transform("object", P)[[ string help = "The UVW coordinate to use. When not connected, defaults to Object space" ]],float Scale = 25.0,string Type = "uperlin"[[ string widget= "popup",string help = "Use perlin, uperlin, cell, hash, simplex or gabor",string options="perlin|uperlin|cell|hash|simplex|gabor" ]],int Octaves = 4[[ string help = "Hos many layers of noise are mixed together" ]],float Lacunarity = 2.0[[ string help = "How much the 'frequency' of the noise changes per layer" ]],float Gain = 0.5[[ string help = "How much the amplitude of the noise changes per layer. Higher numbers means higher noise frequencies have more effect." ]],int StepFunction = 1[[ string widget= "checkBox",string label = "Step Function",string help = "Enables a per-layer smoothstep curve in the noise, allowing you to increase the 'contrast' of the noise" ]],float LowStep = 0.5[[ string help = "Low threshold of the smoothstep function.",string label = "Low Step",float min = -1.0, float max = 1.0 ]],float HiStep = 0.8[[ string help = "High threshold of the smoothstep function.",string label = "High Step",float min = -1.0, float max = 1.0 ]],int Normalize = 1[[ string widget= "checkBox",string help = "If the noise is auto-normalized to Amplitude or not." ]],float Amplitude = 1.0[[ string help = "The amplitude of the noise." ]],float Phase = 0.0[[ string help = "The 'Phase' is just a 4th coordinate of the noise, can be used to allow it to evolve over time, for example." ]],output float Out = 0,){point pnt = UVW / Scale;float sum = 0;float curFreq = 1.0;float curAmp = Amplitude;// Loop over number of octavesfor (int i = 0; i < 4; i++){// Compute a noise valuefloat ns = noise(Type, pnt * curFreq, Phase + i);if (StepFunction)ns = smoothstep(LowStep, HiStep, ns);// Add our result to the outputOut += ns * curAmp;// Add the amplitude to the normalizing sumsum += curAmp;// Step up frequency and amplitudecurFreq *= Lacunarity;curAmp *= Gain;}if (Normalize)Out /= sum / Amplitude;}Also, we’re working on supporting noise shader in Maya. Check out the upcoming Verge3D preview release.
-
This reply was modified 1 month, 1 week ago by
Alexander Kovelenov.
-
This topic was modified 2 months, 1 week ago by
-
AuthorPosts
- You must be logged in to reply to this topic.